Couldnt figure out how to code this problem

i read the editorial solution but still couldnt get it. in editorial solution the was no use of else statement which according to me is compulsory to to use if we use else if.moreover there was no conditon as to how to continue when curr<prev and seq is decreasing.
Overall can u please explain me the whole code in better language and if possible with an easy code

@abhinavgoyal912 it is not mandatory to use an else statement after an else if block. https://ide.codingblocks.com/s/192000 You can look at this code for better understanding, otherwise the editorial is quite elaborate. Please tell me if you are still stuck.

Hi @abhinavgoyal912 please mark your doubt as resolved if are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.