Комментарии:
const MISSING = (nums, lower, upper) => {
let arr = [];
var set = new Set(nums);
for (let i = lower; i <= upper; i++) {
if (set.has(i)) {
arr.push(i);
}
}
return arr;
};
const MISSING = (nums, lower, upper) => {
let arr = [];
for (let i = lower; i <= upper; i++) {
if (nums.indexOf(i) == -1) {
arr[i] = i;
}
}
return arr;
};
Your videos are good just the volume is so soo low.
ОтветитьWhat about the case if there's a duplicate number in the array do we need to resort to the hashing or sorting method?
Ответитьthanks for you work, seems like this solution not passing all the test for ex: [1,2,3,4,3], could you verify again?
Ответитьawesome video, thanks andy!
ОтветитьThank you. Excellent explanation!
ОтветитьNice! Which website do you draw on?
ОтветитьThe first way which you explained how to solve it does not work because if input is [0,1] it will not works for output 2.
I tried to solve it this way before i founded your video(:
Thank you for explaining this so clearly!
Ответить