Incorrect answer
Hey @tushaartiwari1997
Your condition for j==ng was incorrect. You need to penalise for a wrong situation encountered. So you need to increase value returned for wrong situation like below.
if(j == ng)
return Integer.MAX_VALUE/2;
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
Still getting the wrong answer
I have made the suggested changes here. See this.