Can you help me here and tell me what’s wrong with my code and where I went wrong? I’ve checked for other custom inputs I was getting the correct answer.
Here’s the link to my code.
Can you help me here and tell me what’s wrong with my code and where I went wrong? I’ve checked for other custom inputs I was getting the correct answer.
Here’s the link to my code.
You should handle the cases when mid == 0 and mid == n - 1 seperately because when mid == 0, mid - 1 index doesnt exist and when mid == n - 1, mid + 1 index doesn’t exist
I have modified your code and have marked the changes
Let me know if you still need any help.