One test case failing. What is wrong in my code??
Sorted Array Challenge
@prashantverma.vn we have to check for cases of equality as well.
For eg, 1 2 2 3 4 5 is also a sorted array, but as you are strictly checking for greater than cases your code will give false in this code, whereas, the correct answer is true.
In line number 10 of your code, change arr[0] < arr[1]
to arr[0] <= arr[1]
and your code will work fine.
Hope this helps.
1 Like