Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


Find Logic 16

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Risolto


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

oltre un anno fa

Carica altro