Solved

middleAsColumn: Return all but first and last element as a column vector

Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

environ 8 ans ago

Solved

Infernal Recursion

Consider the recursion relation: x_n = (x_(n-1)*x_(n-2))^k Given x_1, x_2, and k, x_n can be found by this definition. Wr...

environ 8 ans ago

Solved

Rosenbrock's Banana Function and its derivatives

Write a function to return the value of <http://en.wikipedia.org/wiki/Rosenbrock_function Rosenbrock's two-dimensional banana fu...

environ 8 ans ago

Solved

Trickier Timing

You solution should return control to main program only when the current time ends in either a 5 or 0 (e.g. the current seconds ...

environ 8 ans ago

Solved

Eight Queens Solution Checker

Write a function to verify whether an arrangement of queens on a chessboard is a valid solution to the classic <http://en.wikipe...

environ 8 ans ago

Solved

Minefield Sonar

*Background* In mine-hunting games (e.g. Microsoft Minesweeper), the user is provided with a covered grid that, upon a left c...

environ 8 ans ago

Solved

Mersenne Primes

A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prim...

environ 8 ans ago

Solved

Test if a Number is a Palindrome without using any String Operations

*Description* Given an integer _X_, determine if it is a palindrome number. That is, _X_ is equal to the _X_ with the digits ...

environ 8 ans ago

Solved

Better bullseye matrix

<http://www.mathworks.com/matlabcentral/cody/problems/18-bullseye-matrix Problem 18> asks to create a bullseye matrix like this:...

environ 8 ans ago

Solved

Wilf-Zeilberger pairs

Take as inputs two functions _F_ and _G_, and two scalar values _n_ and _k_. Test whether the functions are candidates to be a W...

environ 8 ans ago

Solved

Parasitic numbers

Test whether the first input x is an n-parasitic number: <http://en.wikipedia.org/wiki/Parasitic_number>. ( _n_ is the second in...

environ 8 ans ago

Solved

Kaprekar numbers

Test if the input is a Kaprekar number: <http://mathworld.wolfram.com/KaprekarNumber.html>. Return a logical true or false. ...

environ 8 ans ago

Solved

Cubic Integer Constrained Solution

Find an integral non-trivial solution (x,y,z ~=0) (x=0 or y=0 or z=0 are trivial) for the cubic equation 987,654,321x + 12...

environ 8 ans ago

Solved

Uniform binary crossover

Given two binary vectors, return the two children by combining the genes of them using a binary crossover mask. More informat...

environ 8 ans ago

Solved

Spherical radius given four points

Determine the radius of a sphere provided four non-coplanar points on the surface of the sphere. pts = [x1 y1 z1; x...

environ 8 ans ago

Solved

Volume of a Parallelepiped

Calculate the volume of a Parallelepiped given the vectors for three edges that meet at one vertex. A cube is a special case ...

environ 8 ans ago

Solved

Angle between Two Vectors

The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and ve...

environ 8 ans ago

Solved

Make blocks of color

Given a (Nx3) sequence of RGB colors, I want to create a (numRowBlocks x numColBlocks x 3) image comprising (blockSize x blockSi...

environ 8 ans ago

Solved

First non-zero element in each column

For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

environ 8 ans ago

Solved

More luck than brains

Give a random function that guess and return numbers from 1 to 6 exactly like the test suite .

environ 8 ans ago

Solved

The Birthday Phenomenon

First off, leap years are not being considered for this. In fact the year that people are born shouldn't be taken into considera...

environ 8 ans ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

environ 8 ans ago

Solved

Compute a dot product of two vectors x and y

x and y are input vectors, d is a number and contains their dot product

environ 8 ans ago

Solved

Woodall number

Test whether the input is a Woodall number: <http://en.wikipedia.org/wiki/Woodall_number> _Please do not cheat by simply chec...

environ 8 ans ago

Solved

2 b | ~ 2 b

Given a string input, output true if there are 2 b's in it, false if otherwise Examples: 'Macbeth' -> false 'Publius Cor...

environ 8 ans ago

Solved

Make a simplified barcode

Given an integer to encode, make a barcode using the following encoding scheme: * The bar code is made from the binary versio...

environ 8 ans ago

Solved

Compress strings (not springs)

Please remove excess space, limit one space between others, and no space before punctuation marks. * For example, 'Trendy , ...

environ 8 ans ago

Solved

Wind outward from the center ...

Create an n-by-n matrix with elements ranging from 1 to n^2 in a rectangular spiral pattern. Example if n = 5 : 21 ...

environ 8 ans ago

Solved

Rotate a Matrix

Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

environ 8 ans ago