Solved


Become the leader
The goal of this problem is the same as the goal of the rest of them: *become the leader*. Actually, you can only solve this ...

12 years ago

Solved


Now!
I said now!

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

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

12 years ago

Solved


peta to nano (x-ray)
for certain x-ray radiation, given frequency in petahertz, give wavelength in nanometer, must be accurate +/- 25%

12 years ago

Solved


Find number of days
The input is two date in string format (dd-mm-yyyy) find out the number of days between these two dates. Example: input: ...

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

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

12 years ago

Solved


How many trades represent all the profit?
Given a list of results from trades made: [1 3 -4 2 -1 2 3] We can add them up to see this series of trades made a profit ...

12 years ago

Solved


Spot the outlier
All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

12 years ago

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

12 years ago

Solved


Finite Continued Fraction
Given an input real number x and a natural number n, output the row vector with the n first terms of the continued fraction. F...

12 years ago

Solved


Solitaire Cipher
Implement the <http://en.wikipedia.org/wiki/Solitaire_(cipher) solitaire cipher>. Since this is from Wikipedia, I am capturin...

12 years ago

Solved


Read a column of numbers and interpolate missing data
Given an input cell array of strings s, pick out the second column and turn it into a row vector of data. Missing data will be i...

12 years ago

Solved


DNA N-Gram Distribution
Given a string s and a number n, find the most frequently occurring n-gram in the string, where the n-grams can begin at any poi...

12 years ago

Solved


Connect Four Win Checker
<http://en.wikipedia.org/wiki/Connect_Four Connect Four> is a game where you try to get four pieces in a row. For this problem, ...

12 years ago

Solved


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 ago

Solved


Sum the entries of each column of a matrix which satisfy a logical condition.
Given a numeric matrix A and a logical array L of the same size as A, return a row vector S containing the columnwise sums of th...

12 years ago

Solved


Compute the dilation of a binary image
A basic operation in image analysis is the dilation. Given an image where each pixel is either on or off (black/white, true/fals...

12 years ago

Solved


Knight's Tour Checker
Given a matrix a, determine whether or not a legal <http://en.wikipedia.org/wiki/Knight's_tour knight's tour> is present. The kn...

12 years ago

Solved


Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples : n=2, A=[1 2 3] -> [1 1 2 2 3 3] n=0...

12 years ago

Solved


What is Title of Cody Challenge 42?
Given a Cody Challenge number return its Title. *Input:* Cody Challenge Number *Output:* Title of the Cody Challenge ...

12 years ago

Solved


N-Queens Checker
Picture a chessboard populated with a number of queens (i.e. pieces that can move like a queen in chess). The board is a matrix,...

12 years ago

Solved


The Tower of Hanoi
In the <http://en.wikipedia.org/wiki/Tower_of_Hanoi Tower of Hanoi problem> with 3 rods (1, 2 & 3), the goal is to move a tower ...

12 years ago

Solved


Replace all zeros and NaNs in a matrix with the string 'error'
Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with ...

12 years ago

Solved


Community Problem 500!
In honor of this being the 500th Community problem, see if you can create a function that has a Cody size of 500. It can do any...

12 years ago

Solved


Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

12 years ago

Solved


Calculate the Hamming distance between two strings
Inspired by a similar Cody problem found <http://www.mathworks.com/matlabcentral/cody/problems/93-calculate-the-levenshtein-dist...

12 years ago

Solved


Add more zeros
Find code that adds one 0 to each sequence of 0 in a string (composed with only 0 or 1). For example: '1010' -> '100100' ...

12 years ago

Solved


Permute diagonal and antidiagonal
Permute diagonal and antidiagonal For example [1 2 3;4 5 6;7 8 9] -> [3 2 1;4 5 6;9 8 7] WITHOUT diag function (and variable n...

12 years ago

Load more