You are viewing a single comment's thread. Return to all comments →
Hint for those who pass all test cases except fail 7, 10, 11, 12 and 16 by which are producing extra numbers and missing small sums:
7, 10, 11, 12
16
Extra sums, credit @boon_low
97, 96, 82, 73, 61, 57, 51, 29, 29, 24, 18, 14, 11
129, 127, 91, 79, 79, 70, 68, 62, 60, 48, 38, 29, 20, 11, 10
136, 126, 99, 93, 53, 49, 49
My problem was using a left-folding implementation of Kadane's algorithm instead of a right-folding one.
Consider this, credit @t0mpr1c3
5 3 1 -1 999 -2 2
What is the correct answer?
I thought it was 999, 2, 1 for hours, but the actual correct answer is 999, 2.
999, 2, 1
999, 2
Seems like cookies are disabled on this browser, please enable them to open this website
Order exercises
You are viewing a single comment's thread. Return to all comments →
Hint for those who pass all test cases except fail
7, 10, 11, 12
and16
by which are producing extra numbers and missing small sums:Extra sums, credit @boon_low
97, 96, 82, 73, 61, 57, 51, 29, 29, 24, 18, 14, 11
129, 127, 91, 79, 79, 70, 68, 62, 60, 48, 38, 29, 20, 11, 10
136, 126, 99, 93, 53, 49, 49
My problem was using a left-folding implementation of Kadane's algorithm instead of a right-folding one.
Consider this, credit @t0mpr1c3
What is the correct answer?
I thought it was
999, 2, 1
for hours, but the actual correct answer is999, 2
.