I was trying to solve a the question in Segment Tree section in Edu section (Segment Tree, Step2, Problem A (segment with maximum sum)) using iterative version of segment tree, but it's not working with it while the recursive version with the same logic works.
Could anyone please help with this? I am unable to find out where I am mistaking.
Code
Thanks.