I am getting the wrong answer in one test case, rest all work fine. My code is https://ide.codingblocks.com/s/196162
@adarsh_anand Please make this change in your code cout<<lastIndex(a, 0, n, m);