6 kyu
Guess the array
35 of 342ice1000
Description:
In this kata, you should determine the values in an unknown array of numbers.
You'll be given a function f
, which you can call like this:
f a b -- returns an Integral
where a
and b
are indexes of two different elements in the unknown array, 1 or 2 indexes apart. f
will return the sum of those two elements.
The absolute difference between a
and b
must not be 0 nor greater than 2 (that is: the chosen indexes must be exactly 1 or 2 apart).
Your goal is to figure out the correct array.
The whole procedure is:
- You are given
f
and the length of the arrayn
. - Ask
f
for any element sums you want. - Create and return the correct array according to the answers.
The array will always have at least 3 elements.
Don't forget to give upvotes and feedbacks!
Puzzles
Algorithms
Arrays
Similar Kata:
Stats:
Created | Jun 8, 2017 |
Published | Jun 8, 2017 |
Warriors Trained | 1721 |
Total Skips | 62 |
Total Code Submissions | 1467 |
Total Times Completed | 342 |
Haskell Completions | 35 |
JavaScript Completions | 122 |
C# Completions | 48 |
Python Completions | 141 |
Rust Completions | 33 |
Total Stars | 30 |
% of votes with a positive feedback rating | 98% of 107 |
Total "Very Satisfied" Votes | 102 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |