Question: https://hack.codingblocks.com/app/practice/1/300/problem
My answer: https://ide.codingblocks.com/s/414369
In the video, Prateek bhaiyya explained the approach, and this is my implementation based on that approach.
Test case - 0,1,2 - correct answer
Test case - 3,4,5 - wrong answer