Feeds
已解决
Make a 1 hot vector
Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...
12 years 前
已解决
Is this triangle right-angled?
Given any three positive numbers a, b, c, return true if the triangle with sides a, b and c is right-angled. Otherwise, return f...
12 years 前
已解决
Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...
12 years 前
已解决
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...
12 years 前
已解决
Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise
12 years 前
已解决
Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...
12 years 前
已解决
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!
12 years 前
已解决
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...
12 years 前
已解决
Arrange vector in ascending order
Arrange a given vector in ascending order. input = [4 5 1 2 9]; output = [1 2 4 5 9];
12 years 前
已解决
Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...
12 years 前
已解决
Back to basics 8 - Matrix Diagonals
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...
12 years 前
已解决
Program an exclusive OR operation with logical operators
Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...
12 years 前
已解决
All capital?
Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0
12 years 前
已解决
Lightning strike distance: Writing a function
Write a function named LightningDistance that outputs "distance" given input "seconds". Seconds is the time from seeing lightnin...
12 years 前
已解决
Find the sum of the elements in the "second" diagonal
Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.
12 years 前
已解决
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
12 years 前
已解决
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...
12 years 前
已解决
Back to basics 6 - Column Vector
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...
12 years 前
已解决
Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12
12 years 前
已解决
Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];
12 years 前
已解决
Make one big string out of two smaller strings
If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...
12 years 前
已解决
Pizza value using expression with parentheses
Pizza prices are typically listed by diameter, rather than the more relevant feature of area. Compute a pizza's value (cost per ...
12 years 前
已解决
Get the length of a given vector
Given a vector x, the output y should equal the length of x.
12 years 前
已解决
First N Perfect Squares
*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];
12 years 前
已解决
Omit columns averages from a matrix
Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...
12 years 前
已解决
Create a row array using double colon operator
Create a row array from 9 to 1, using the double colon operator.
12 years 前


