code 1:
1. 没有考虑x == null的情况
2. for循环应该遍历到i>= 0的时候才退出
test1: x = [2, 3, 5]; y = 5
expected = 2
actual = 2
test2: x = [2, 3, 5]; y = 1
expected = -1
actual = -1
test3: x = null; y = 1
expected = -1
actual = -1
code2 :
1. 没有考虑x == null的情况
2. 返回的是数组中的第一个0而不是最后一个0
test1: x = []
expected = -1
actual = -1
test2: x = [1, 2, 3]
expected = -1
actual = -1
test3: x = [0, 1, 2]
expected = 0
actual = 0