Fastest category solution for c++ is wrong


#1

For the test cases in which the first and last element are equal, it fails. For eg:- 4 5 6 1 2 3 4 and B=5, the solution is returning -1.