Sep232018 2:30pm : Cody #450

Solved

Generate N equally spaced intervals between -L and L

Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

1 year ago

Solved

Binary numbers

Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

1 year ago

Solved

letter yes yes & letter no no

Split a string into two strings, wherein the first string has all alphabetic letters and the second string has all the remaining...

1 year ago

Solved

Number of 1s in a binary string

Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

1 year ago

Solved

Hard limit function

Classify x data as if x>=0 then y=1 if x<0 then y=0 Example x = [ -2 -1 0 1 2] y = [ 0 0 1 1 1]

1 year ago

Solved

Side of an equilateral triangle

If an equilateral triangle has area A, then what is the length of each of its sides, x? <<http://upload.wikimedia.org/wikipe...

1 year ago

Solved

Tridiagonal

Return an n-by-n matrix that has a, b, c as the subdiagonal, main diagonal, and superdiagonal entries in the matrix. Example ...

1 year ago

Solved

Another colon problem

This is simple problem based on problems 555, 801, 1118, etc. Create an index vector from two input vectors. Example: ...

1 year ago

Solved

Area of an Isoceles Triangle

An isosceles triangle has equal sides of length x and a base of length y. Find the area, A, of the triangle. <<http://upload...

1 year ago

Solved

Area of an equilateral triangle

Calculate the area of an equilateral triangle of side x. <<http://upload.wikimedia.org/wikipedia/commons/e/e0/Equilateral-tr...

1 year ago

Solved

Length of a short side

Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

1 year ago

Solved

Is this triangle right-angled?

Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

1 year ago

Solved

surrounded matrix

With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones: A = [1 2 ...

1 year ago

Solved

Rotate input square matrix 90 degrees CCW without rot90

Rotate input matrix (which will be square) 90 degrees counter-clockwise without using rot90,flipud,fliplr, or flipdim (or eval)....

1 year ago

Solved

Diagonal Pattern

For a positive integer |n|, return an |nXn| matrix |mat| such that the value of each element in row |i| and column |j| is given ...

1 year ago

Solved

Replace secondary diagonal elements of a square array

Replace all the secondary diagonal elements of the square array A with the number n Example: A = [1 2 3 4 5 6 ...

1 year 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

1 year ago

Solved

Arrange vector in ascending order

Arrange a given vector in ascending order. input = [4 5 1 2 9]; output = [1 2 4 5 9];

1 year ago

Solved

Return the first and last character of a string

Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

1 year ago

Solved

Back to basics 12 - Input Arguments

Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

1 year ago

Solved

Back to basics 10 - Max Float

Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive floating-point number MATLAB can han...

1 year ago

Solved

Free passes for everyone!

_Simply return the name of the coolest numerical computation software ever_ *Extra reward* (get a _freepass_): Once a mont...

1 year ago

Solved

Make a Palindrome Number

Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

1 year ago

Solved

Love triangles

Given a vector of lengths [a b c], determines whether a triangle with non-zero area (in two-dimensional Euclidean space, smarty!...

1 year ago

Solved

Who knows the last digit of pi?

There is only one man who knows the last digit of pi, who is that man? Give the name of that man, who, by popular believe, can ...

1 year ago

Solved

Determine Whether an array is empty

Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

1 year ago

Solved

All capital?

Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

1 year ago

Solved

Number of Horns on a unicorn!

Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

1 year ago