Problem 1940. Decimation - Optimized for speed
This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will be based on how quickly you can determine which person will survive.
The sample sizes (num_prisoners) and number of prisoners killed (num_killed) will be larger than in the original problem, but other than that the problem sets are identical.
Solution Stats
Problem Comments
-
2 Comments
Not quite identical to the original problem. In the original problem kill_every is always larger or equal 2, here it can be also 1...
My submissions keep getting an error that they time out for all the test cases. Running tic/toc on it for case one in the Scratch Pad it takes 0.003869sec. My solution works for problem 1092. If I hard code a numeric output the test cases do not time out.
Solution Comments
Show commentsGroup

CodeCrunch 1
- 11 Problems
- 10 Finishers
- Calculate the height of an object dropped from the sky
- Compute the missing quantity among P, V, T for an ideal gas
- Remove duplicated triangles
- An Ohm's Law Calculator
- Laws of motion 6
- Find the longest sequence of 1's in a binary sequence.
- Determine whether a vector is monotonically increasing
- Calculate the probability that at least two people in a group share the same birthday.
- Finding Perfect Squares
- The Goldbach Conjecture
- Pangrams!
Problem Recent Solvers189
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!