You are viewing a single comment's thread. Return to all comments →
I am getting wrong answer for all cases except first and last,and timeout error for testcase 8.works for sample case,works for 2 1000000000 1000000000 5 1 outputs 0 0.help?
At one point, I also had wrong answers for all cases except for the first and the last. For me, it was because I wasn't keeping track of the previously found sums. There are some consecutive squares that has the same answer. You shouldn't be adding the same number twice.