Hello everyone, I was solving question 1521B and then I submitted my solution. In test case 2, my solution exceeded time limit and after that I referred to editorial. My Solution and editorial solution are having same time complexity of O(n). Can anyone help me with what's wrong with my solution?
If you submit this code using
GNU C++20 (64)
instead, you might see a Runtime error and not a TLE.