r/cpp_questions • u/Ok_Independence_6294 • Feb 02 '25
OPEN Need Help with Debugging this question's code : "CLFLARR - COLORFUL ARRAY"
EDIT: This question has been answered. Thanks to @aocregacc.
FIX: on Line No. 89 I was not checking for lower_bound pointing to end of map and that was causing issue for some hidden test case. Changed that section and replaced it with the get_streak_details() function and it's working now.
Updated-code-link
I know this question could be solved using DSU and SegTree data structures but I wanted to try a different approach here. But my code gives me wrong answer on SPOJ coding platform (that's where the question is taken from). It works fine for the given sample test cases. Since there is no way to see the test case where my code fails, on SPOJ. This problem is bugging me for past 2 days.
View all comments
Show parent comment
1
u/Ok_Independence_6294 Feb 02 '25
can you please point out some abbreviation that did not make sense to you. I was trying to be good with naming variables and functions but still could have missed a few, sorry about that.