the first approach breaks with input: [3,2,4] and target = 6
the code outputs [-1,-1] whereas expected answer should be [1,2]
the first approach breaks with input: [3,2,4] and target = 6
the code outputs [-1,-1] whereas expected answer should be [1,2]
Hello @Shamim_Imtiaz
The problem statement states that the numbers inside the array are in sorted order. Hence, [3,2,4]
is not a valid test input. It should be [2,3,4]
.
Hope this helps!