This is my code
for i in range(len(nums) - 1):
if all(num > target for num in nums[i + 1:]):
return i
return -1
When I input the target 2 and the list of [1,2,2,3,4] it supposed to output 3 but it returns 2, and input the target of 7 and the list of [7,8,9,10,12] it supposed to output 4 but it return 0.
1