Wrong Test Cases in the Question


#1

There are incorrect test cases in the problem. It clearly says to return the lowest index1 as the answer. The test case that is incorrect is:

A : [ 4, 7, -4, 2, 2, 2, 3, -5, -3, 9, -4, 9, -7, 7, -1, 9, 9, 4, 1, -4, -2, 3, -3, -5, 4, -7, 7, 9, -4, 4, -8 ]

B : -3

Now, the answer as given by the Judge is : 4 8

However, the answer as returned by my code (which is correct) is : 0 12 in which the index1 is lower than the answer given.

Please correct either the test cases or the problem cases. If there is something that I am missing, please correct me. Thanks!


#2

First sort based on index 2 and then based on index 1.


#3

Why is 3,7 not an answer ?


#4

Oh sorry “not zero based”.


#5

My answer is same 1 13 as indexing is not from 0


#7

I finally understood why it is not 1,13 and 4,8. In the question, it says that choose the one with the lower index 2 i.e. not the first occurrence. So in (3,7) and (1,13). 7<13 so that is the final answer.