Hello, why I am not able to clear all the test cases.
Here is my code :
Doubt in my code
Hey @yashsharma4304 the logic you have used is right but think what if you have all negative integers in an array
For eg
-2 -1 -7 -10 , here maximum value should be -1 right, but yourself is giving zero. You getting why you are not passing all test cases?
Okk so how do I resolve this issue ?
Okay , so you are initialising your max_value with 0, instead what if you initialise it with a[0]. Do it and let me know if you passed all test cases or not.
can I initialize it with INT_MIN ?
Yes you can, no issue with it.
1 Like
Yeah, Now i understand what was the problem this resolves my issue. Thank you.
