Desired output,Wrong Answer

Hi!
Please someone tell me what is wrong in my code for the question Paying Up:link text

Here is the link for my code:
[link text][2]

[2]:[link text][2]

[2]: http://ideone.com/e.js/YXIpib" type=“text/javascript” >

For the below input:

1

4 7

5 2 1 3

The output of your solution is:

No

Whereas the expected output should be:

Yes

1 Like

Thanks I’ll make changes in my code accordingly