A résolu


So many choices
For inputs _n_ and _k_ (in that order), output the number of ways that k objects can be chosen from amongst n distinct objects. ...

presque 4 ans 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...

presque 4 ans il y a

A résolu


Maximum sum from any 2 numbers with a variable number of inputs
Given a variable number of inputs, combine any 2 numbers from the inputs and output the maximum sum the combinations can generat...

presque 4 ans il y a

A résolu


Red and green towers
Frankie has a large number of wooden cubes, painted in red and green. He is building little towers with his cubes, by stacking t...

presque 4 ans il y a

A résolu


A (wrong) place for everything, and everything in its (wrong) place
You have an equal number of cups and balls, each labelled from one to N. You randomly place one ball in each cup. Determine th...

presque 4 ans il y a

A résolu


Numbered lottery balls into cells
You are running a lottery, and have a number of different balls numbered 1 to N. Your job is to figure out how many different w...

presque 4 ans il y a

A résolu


NCHOOSEK - Time Optimization
*Input* * *V* —— Set of all choices, a vector of N, 1 < N < 100 * *K* —— Number of selected choices, a scalar, 0 <= K <=...

presque 4 ans il y a

A résolu


Hexagonal Tiling Dots in a Circle
Return how many <http://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling> grid points there are inside a circle of radius _...

presque 4 ans il y a

A résolu


Minimum Distance Point to Segment
This Challenge is to determine the minimum distance from a 2-D line segment defined by two points to a point. The point is (p...

presque 4 ans il y a

A résolu


Perimeter
Given a sequence of points forming a closed path (first and last points are coincident) return the perimeter value. For example...

presque 4 ans il y a

A résolu


Shifted Hexagonal Tiling Dots in a Circle
Return how many <http://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling> grid points there are inside a circle of radius _...

presque 4 ans il y a

A résolu


Edges of a n-dimensional Hypercube
Return the number of edges on an <http://en.wikipedia.org/wiki/Hypercube _n_-dimensional hypercube> (with an integer n &ge; 0). ...

presque 4 ans il y a

A résolu


Dots in a Sphere
Return how many integer grid points there are inside a 3D sphere of radius _r_ centred at (0,0,0) (including points on the edge)...

presque 4 ans 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). ...

presque 4 ans il y a

A résolu


Put m balls into n boxes (again)
According to <http://www.mathworks.com/matlabcentral/cody/problems/1516-put-m-balls-into-n-boxes Cody Problem 1516>, if I put 3 ...

presque 4 ans il y a

A résolu


Put m balls into n boxes
Can you find all the cases where, if I put 3 balls into 2 boxes the case is 1 1 1 1 1 2 1...

presque 4 ans il y a

A résolu


Which way to go?
Given an m*n grid, How many ways are there to go from upper left corner to the lower right one? You can only move right...

presque 4 ans il y a

A résolu


Number of paths on a grid
Consider a grid formed by n vertices vertically down, and m vertices horizontally right. Your starting point is at the top lef...

presque 4 ans il y a

A résolu


Generate binary combinations for a given number of bit(s)
Generate the binary combination as in the example below. Example: If you are given: bin_comb(2) The answer will be: ...

presque 4 ans il y a

A résolu


Get ranking of a combination looking for speed.
I have the numbers pulled without replacement from the set [1 2 3 4 5 6 7 8 9 10 11 12 13]; They are then ordered from least to...

presque 4 ans il y a

A résolu


Create Combination
Motivation: In many problems, we need to create combinations with the function nchoosek. In some cases, however, choices are lim...

presque 4 ans il y a

A résolu


Get ranking of a combination
I have the numbers pulled without replacement from the set [1 2 3 4 5 6 7 8 9 10 11 12 13]; They are then ordered from least to...

presque 4 ans il y a

A résolu


Combinations without using nchoosek
You have to generate a matrix with all possible combinations of n elements *taken 2* at a time, *without using nchoosek(1:n,2)* ...

presque 4 ans il y a

A résolu


Possible Outcomes of American Roulette
The payout for American roulette can be calculated by: payout = (38/n)-1 where n is the number of squares the bet covers. ...

presque 4 ans il y a

A résolu


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

presque 4 ans il y a

A résolu


Circular Primes (based on Project Euler, problem 35)
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. The...

presque 4 ans il y a

A résolu


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

presque 4 ans 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...

presque 4 ans 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...

presque 4 ans il y a

A résolu


Find the next prime number
Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

presque 4 ans il y a

Charger plus