Help with approach
done still, not working
last example test case is failing ans shd be 3 it is giving 4
check now->
if previous < current then cnt++
else if previous ==current then we need to increase current by 1 and then cnt++
also update previous max in both the case
can you please explain the concept for the algorithm I’m not able to understand.
see given array is sorted.
so x[i]<=x[i+1] will always hold.
we can break this condition in x[i] == x[i+1] and x[i] < x[i+1] and then solve them seprately.
case x[i]< x[i+1] clealry we include x[i+1] so cnt++
case x[i]==x[i+1] here we need to increase x[i+1] by 1 to make x[i] < x[i+1] and then cnt++;
