Today I was trying to solve this problem . But I couldn't solve it . So I tried to understand some solution but still ;( .
Spoiler
I saw this code but couldn't understand . Can anybody help me getting this solution or can you please tell me how to solve this problem .
Thanks ...