WA in RECNDNOS(Chef and Numbers)

Please help me find out what’s wrong in my solution in
Chef and Numbers

Link to solution
https://www.codechef.com/submit/complete/32370784

Firstly, Indentation is horrible. Please fix it.

Secondly, as far as I see, your flag variable indicates whether I’m free to take this even if the last one was equal. Then why is flag=1 in your outermost else in the main loop. Flag is also generally a bad variable name. It is better to use intuitive variable names to avoid mistakes like this.

1 Like

Yeah it was terrible sorry for that.(fixed it)

regretting making such stupid mistake.

Thanks a lot.

1 Like