code: https://ide.codingblocks.com/s/434916
prob: https://atcoder.jp/contests/abc152/tasks/abc152_c
why won’t this approach pass all test cases, (it is passing all the sample ones)
code: https://ide.codingblocks.com/s/434916
prob: https://atcoder.jp/contests/abc152/tasks/abc152_c
why won’t this approach pass all test cases, (it is passing all the sample ones)
hello @raghav007
read the condition carefully->
for index i to be a valid answer, it should be smaller than all element to its left.
the idea is to keep track of minimum element , increment ur answer if min till i-1 >= p[i]
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.