I solved this problem a few days ago and I just can’t understand the reason why the first submission got WA and the second one got accepted.
All I did in the second submission was interchanging the if, else conditions. Can someone please explain to me the reason behind this?
Here are my two submissions -
Code which got WA - here
Code which got AC - here