I had been submitting my code(which I think is correct) many times …
but after submission what I got was WA in 3,4,5,8 cases.
But after that I submitted a code of inconvenient logic ,i.e, longest sequence and …it accepted. I checked the answers by both the code for this sequence “<<><<<” which shall be 5 because “1<2<3>2<3<4<5” . The code which was not accepted gave the answer 5 while the code that was accepted gave 4. Can anyone please explain whats happening!!
Observe the question carefully and try harder. Check all cases by your own and see the relation between answer and the sequence. I hope you will get the answer soon.