Find last element problem

https://ide.codingblocks.com/s/276293 3 case is not passing plz help me out

@anuragavm123
I have fixed your code. please check.
I have added a index variable to keep a check on positions.