Whats wrong here?? HELP!!

It’s a question of starter 14
question - CodeChef: Practical coding for everyone
My solution - CodeChef: Practical coding for everyone

Consider the test input:

1
2 0
1 Like

understood …I have wrongly handled the case of k = 0. Thank You very much. Now I can sleep

1 Like

I implement it and found that I have handled case n=k wrongly but after implementing
there still some problem. can u check??sorry for trouble. solution link ::CodeChef: Practical coding for everyone

Consider the input

1
3 0

output is
3,2,1
I guess its correct. is it??

Number of indices i such that A_i = i is exactly K

In your case, i=2 will satisfy the condition and hence the number of indices will be 1, but it should be 0

One valid solution would be 2 3 1

2 Likes

yup…got it … thanks

learnt to cover all the corner cases