Getting WA in KRYP6

Hi,

I don’t know where i am getting wrong with my code can anybody can figure it out please.

I am not getting why to use binary search in this question.

Link to the question.

Click here for my code

Thank’s a lot.

can u please give the link to the question :slight_smile:

I think you have not understood the question properly.
Try this test case :

5
5 4 1 2 3

Here your code fails .

now i have provided you question link also.

thank’s for that