Question: Have a bug and need to fix it function solution(A, K) { var n = A.length; for (var i = 0; i < n -
Have a bug and need to fix it
function solution(A, K) {
var n = A.length;
for (var i = 0; i < n - 1; i++) {
if (A[i] + 1 < A[i + 1])
return false;
}
if (A[0] != 1 && A[n - 1] != K)
return false;
else
return true;
}
Step by Step Solution
3.31 Rating (151 Votes )
There are 3 Steps involved in it
function solutionA K var n Alength Asorta b a b Sort the ... View full answer
Get step-by-step solutions from verified subject matter experts
