解決済み


Probabilities - Balls and urns - 02
The urn contains B blue balls and R red balls. Each trial consists of drawing one random ball from the urn and observing its col...

24日 前

解決済み


ZigZag - 03
Given a matrix of any size, print its elements from the zigzag form of the matrix. For example, a=[1 2 3; 4 5 6; ...

24日 前

解決済み


No of squares in a grid
given a m*n grid calculate the no of possible squares & rectangles on that grid. output: y=[no of rectangles , no of sqa...

24日 前

解決済み


Palindromic Primes
A Palindromic Prime is a prime number that is also a palindromic number. (Wiki, OEIS) If given a monotonic series (increment...

24日 前

解決済み


ismember: Enhanced Performance for 'rows' and width - Speed Scoring (66% savings)
The Challenge is to perform very fast the 'ismember' function for a long and wide array. The width of the array is expanded fro...

24日 前

解決済み


Unique: Enhanced Performance - Large and Wide Array - Speed Improvement (66% savings)
The Challenge is to perform very fast unique function for a long and wide array. The data is small integer representing data ...

24日 前

解決済み


1D DCT-II transform.
Implement a function that calculates 1D Discrete Cosine Transform <http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II...

25日 前

解決済み


Wrap a vector, but insert NaN's at the wrap-positions.
When you plot a line that wraps, and do not want the sawtooth shape to show up in the plot, you can either draw all separate lin...

25日 前

解決済み


Write a cubic formula function
Create a function that will output the three roots of a cubic equation specified by the 4 coefficients listed as input. The outp...

25日 前

解決済み


Coefficients and vertex of a parabola given 3 points
Given 3 points, each defined by x and y, compute the coefficients: [a,b,c] of a parabola with equation: y = ax^2 + bx + c passin...

25日 前

解決済み


jumping astronauts
The surface gravity on the moon is approximately 2 m/s^2. Thats why an funny astronauts feels as light as a feather and jumps fr...

25日 前

解決済み


Sum the Infinite Series II
For any x in the range 0 < x and x < 2*pi radians, find the sum of the following infinite series: c = 1 + 1/2*cos(x) + 1/2*3/4...

25日 前

解決済み


Cosine frequency doubler
Given an input vector containing a cosine wave of unknown frequency, produce an output vector of the same length containing a co...

25日 前

解決済み


Decrypt a secret message!
The crypto system in question is based on phone keyboard. We need two numbers in order to decrypt a word. First number represent...

25日 前

解決済み


Book Club
A book club that has _K_ members, as a group, have to read _N_ books. Return how many different ways the members could read the ...

25日 前

解決済み


Addition
Add together the values of a and b.

25日 前

解決済み


Barnes G-Function
Evaluate the Barnes G-Function at a given (integral) value. %Example 1 in = 1; out = 1; %Example 1 in = 4; out = 2; ...

25日 前

解決済み


The Google Interview: Two Eggs Problem
Consider the following problem, a popular Google interview question: A firm has invented a super-strong egg. For publicity pu...

25日 前

解決済み


Rock Paper Scissors Lizard Spock
Can't decide what to watch on TV? How about settling the dispute with a good old fashioned round of Paper Scissors Lizard Spock ...

25日 前

解決済み


Sample from random roulette
Given a list of values and their probabilities sample 10,000 values. Example: x = [1 2 3 4 5]; prob = [0.2 0.1 0.4 0.1 0.2] ...

25日 前

解決済み


Create a matrix that counts up diagonally
Given a single input _N_, create a _N_ x _N_ matrix that counts from 1 : _N_ ², (along up-right diagonals, starting with 1 in th...

25日 前

解決済み


Pentagonal dodecahedron
<<https://upload.wikimedia.org/wikipedia/commons/7/73/Dodecahedron.gif>> Pentagonal dodecahedron is a dodecahedron that is ...

25日 前

解決済み


Luhn's Algorithm
Luhn's Algorithm is used as a checksum for credit card numbers or similar identifiers. It can detect single-digit changes and sw...

25日 前

解決済み


How many complete pizzas (number 2)
x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut...

25日 前

解決済み


Portfolio diversification: choose your stocks !
we have the returns of 3 stocks for the last 4 years and we have to combine only 2 stocks that are less correlated. Example: st...

25日 前

解決済み


Sieve of Eratosthenes
Find the nth lucky prime number. <https://planetmath.org/luckyprime> can u find a way for large n?

26日 前

解決済み


XOR fibonacci
a & b are the first two terms in the xor fibonacci sequence. Find the nth term of that sequence. XOR fib sequence is that in ...

26日 前

解決済み


Easy Sequences 30: Nearly Pythagorean Triangles
A Nearly Pythagorean Triangle (abbreviated as "NPT'), is an integer-sided triangle whose square of the longest side, which we wi...

26日 前

解決済み


Locate a family on a long street

26日 前

さらに読み込む