Question: https://hack.codingblocks.com/app/practice/1/1057/problem
My solution: https://ide.codingblocks.com/s/414468
Coded as per the approach given in the video by Prateek bhaiyya. Code was home-work part.
Test cases - 0, 2, 4 - wrong answer
Test cases - 1, 3, 5 - correct answer