i don’t think you need to check like that way.
you can see the test case clearly where you are wrong.
just check if two adjacent elements have a difference of more than 2 that is your answer
Yeah i read the tutorial and it states the same but I just want to know the problem in my code…?
I m checking left and right of max element of array and trying to find out where the condition holds true!
Pls correct me.
You solution does not pass the sample tests as well.
Check @shim98 solution logic.
Check out this soln : https://ide.codingblocks.com/s/172325
First of all your code goes out of bounds.
for this test case.
Your solution does passes the initial test case…
your solution fails these test cases though.
1 2 3 4 4 4 2 4 4 4 4 4 5 5 5 5
Answer should be
I am not able to follow logic of your solution that well. Tbh sometimes understanding other’s code is like understanding a handwriting but i told you the test cases that didn’t pass so i hope you understand well now
Its totally fine man and thanks a lot for the testCases. Also i got to know the problem in my code! Thanks again. :)