When I checked the code in IDE with the example test case it worked right but now its showing the wrong output for everyone, do check the code.
All outputs are coming wrong
can you explain your logic?
I have applied rotate here so that it creates an circular array and then I check the total sum for each array and compare it with my ans meaning finding element sum at each point and then checking whether it is max or not
if you rotate the subarray it would give wrong answer or TLE, to solve this question you need to apply kadane’s algorithm twice.
1 Like