Feeds
已解决
Create an 8-color version of an image
This problem was inspired by a tweet I saw from @MATLAB regarding <http://www.mathworks.com/matlabcentral/fileexchange/37816-the...
10 years 前
已解决
Distance walked 3D
suppose you go from x-y-z coordinates [3,4,2] to [0,0,2] to [0,1,2] to [1,1,2], to [1,1,20] then you walked 25 units of distance...
11 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 ...
11 years 前
已解决
Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...
11 years 前
已解决
Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...
11 years 前
已解决
Summing digits
Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...
11 years 前
已解决
Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...
11 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...
11 years 前
已解决
First N Perfect Squares
*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];
11 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,...
11 years 前
已解决
Sorting
Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column. Exa...
11 years 前
已解决
Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...
11 years 前
已解决
Indexed Probability Table
This question was inspired by a Stack Overflow question forwarded to me by Matt Simoneau. Given a vector x, make an indexed pro...
11 years 前
已解决
Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...
11 years 前
已解决
Convert Two Character String into a Binary Vector
Given a string "XOXXO" convert it into a binary vector. [1 0 1 1 0] Paul Berglund implemented an optimal method in <http://ww...
11 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...
11 years 前
已解决
Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...
11 years 前
已解决
Matrix indexing with two vectors of indices
Given a matrix M and two index vectors a and b, return a row vector x where x(i) = M(a(i),b(i)).
11 years 前
已解决
Count photos
Given n people, everyone must have pictures taken with everyone, each photo includes only two persons, please count the total nu...
11 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];
11 years 前
已解决
Multiply a column by a row
* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...
11 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...
11 years 前
已解决
Back to basics 9 - Indexed References
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...
11 years 前
已解决
Generate a NaN...on purpose
The goal is to create a function that will return a single "NaN" without using the nan function. I am interested to see how many...
11 years 前
已解决
Dots in a Circle
Return how many integer grid points there are inside a circle of radius _r_ centred at (0,0) (including points on the edge). ...
11 years 前
已解决
Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise
11 years 前
已解决
Determine Whether an array is empty
Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.
11 years 前