|
|
back to boardinput: -3 3 2 2 1 2 2 1 output: 2 your test is wrong 'cause A must be >=0 This tests can help you: 1 3 2 2 1 2 2 1 1 1 3 1 1 2 2 2 1 1 This tests can help you: 1 3 2 2 1 2 2 1 1 1 3 1 1 2 2 2 1 1 I think, that your test's are not correct.Second line must contain f(1),f(2),f(3) and no more. Try tests: 1 9 1 2 1 2 3 2 1 2 1 4 1 10 1 2 1 2 1 0 1 2 1 2 5 1 7 1 2 1 2 1 0 1 5 My solution is greedy. One boolean, one counter and list of nonrecurring array of numbers, but i think, that we can work with numbers during reading. Nice problem :) > 1 7 > 1 2 1 2 1 0 1 > 5 How can that be true? (1, 2), (1, 2), (1, 0), (1) - this means, that answer should be 4. |
|
|