sol- https://ide.codingblocks.com/s/203026 it’s give correct output test case fails.
@sudhanshu8917, Updated Code: here