problem link: https://www.codechef.com/CSEP2020/problems/JOJOA/

Solution link: https://www.codechef.com/viewsolution/37796054

this code is getting accepted despite having (n^2) complexity in the worst case

as it has outer "for " loop which will run n times and inside it a " while " loop which can also run for n times in worst case.

if i am wrong in calculating time complexity,please let me know…