A résolu


Chess probability
The difference in the ratings between two players serves as a predictor of the outcome of a match (the <http://en.wikipedia.org/...

plus d'un an il y a

A résolu


Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

plus d'un an il y a

A résolu


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

plus d'un an il y a

A résolu


Determine the number of odd integers in a vector
Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

plus d'un an il y a

A résolu


Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

plus d'un an il y a

A résolu


A Binary Search
One way to locate a target value in a sorted array, is to use a binary search algorithm. Here, you test if the midpoint in the a...

plus d'un an il y a

A résolu


Implement a counter
Write a function that returns a function that counts the number of times it is invoked. Example: >> h = counter; >> h() ...

plus d'un an il y a

A résolu


Split a string into chunks of specified length
Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

plus d'un an il y a

A résolu


Anagram
Given two strings, check whether they're anagrams to each other or not.

plus d'un an il y a

A résolu


Eight Queens Solution Checker
Write a function to verify whether an arrangement of queens on a chessboard is a valid solution to the classic eight queens prob...

plus d'un an il y a

A résolu


Tic-Tac-Logic - Solution Checker
<http://www.conceptispuzzles.com/index.aspx?uri=puzzle/tic-tac-logic/rules Tic-Tac-Logic> is a logic puzzle wherein a rectangula...

plus d'un an il y a

A résolu


Magnet and Iron
(Inspired from <http://www.mathworks.com/matlabcentral/cody/problems/112 Problem 112: Remove the air bubbles>) Iron (atomic n...

plus d'un an il y a

A résolu


Additive persistence
Inspired by Problem 2008 created by Ziko. In mathematics, the persistence of a number is the *number of times* one must apply...

plus d'un an il y a

A résolu


Find nth maximum
Find nth maximum in a vector of integer numbers. Return NaN if no such number exists. x = [2 6 4 9 -10 3 1 5 -10]; So ...

plus d'un an il y a

A résolu


Sum the Digits of a Number
Given an integer, sum the digits repeatedly until you end up with a single value less than 10. For example, if you add the di...

plus d'un an il y a

A résolu


Set some matrix elements to zero
First get the maximum of each *row*, and afterwards set all the other elements to zero. For example, this matrix: 1 2 3 ...

plus d'un an il y a

A résolu


Find two numbers that add up to the target value
Given a vector A and target n, return the indices of two numbers that add up to n. If there are multiple solutions, return the f...

plus d'un an il y a

A résolu


Find nearest prime number less than input number
Find nearest prime number less than input number. For example: if the input number is 125, then the nearest prime number whi...

plus d'un an il y a

A résolu


Longest Divisor Run
Given the vector a, find the longest run of consecutive numbers that can be evenly divided by the same number d where d > 1. ...

plus d'un an il y a

A résolu


Find Logic 16

plus d'un an il y a

A résolu


Is it really a 5?
A number containing at least one five will be passed to your function, which must return true or false depending upon whether th...

plus d'un an il y a

A résolu


Extract leading non-zero digit
<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

plus d'un an il y a

A résolu


Still more miles to go before I sleep
It's time for more odometer fun. Last problem, my car's odometer hit 56789. It's coming up on 111111 now, which (barring a maj...

plus d'un an il y a

A résolu


Find an optimal placement of coolers on a grid
In a certain chemical plant, 6 new pieces of cooling equipment (coolers) are to be installed in a vacant space. This vacant spac...

plus d'un an il y a

A résolu


Lowest sum from a group of digits
Hi there. It's James's daughter here again, and my third grade math teacher is up to her old tricks. This time, she's giving u...

plus d'un an il y a

A résolu


Determine if a Given Number is a Triangle Number
*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

plus d'un an il y a

A résolu


Miles to go before I sleep
Recently, my car's odometer passed 56789. Given an odometer reading, output how many miles need to be driven to get the next mi...

plus d'un an il y a

A résolu


Is It a Snake?
Given an m-by-n matrix, return true if the elements of the matrix are a connected "snake" shape from 1 to m*n. Otherwise return ...

plus d'un an il y a

A résolu


Simulate one complete step in the Biham–Middleton–Levine traffic model
The <http://en.wikipedia.org/wiki/Biham%E2%80%93Middleton%E2%80%93Levine_traffic_model Biham–Middleton–Levine traffic model> is ...

plus d'un an il y a

A résolu


Maximum running product for a string of numbers
Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

plus d'un an il y a

Charger plus