Community Profile

Contact

Top 1% contributor

Constructions that use feval or eval are used to cheat with cody. This test-suite tries to avoid that trick. The goal of this...

Solve this!

3 years ago

Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west. If th...

You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...

*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

4 years ago

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

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

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

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...

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

Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

Given a row vector of numbers, find the indices of the two nearest numbers. Examples: [index1 index2] = nearestNumbers([2 5 3...

Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

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...

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

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...

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

Load more

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend you select United States from the following list:

See all countries