Strongest fighter problem

why all test cases are wrong except last test case?
while code is working for every input

Hey @tarangsinghal2
Your approach is not correct. It might have worked on just one test case.

  1. You always put i in the deque from the back.
  2. Keep on removing elements from the end which are smaller than current element.
  3. While index at front of deque is smaller than current index pop it.

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.