LEETCODE 268 (JAVASCRIPT) | MISSING NUMBER

LEETCODE 268 (JAVASCRIPT) | MISSING NUMBER

Andy Gala

3 года назад

4,776 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@yashrajbharti9302
@yashrajbharti9302 - 01.01.2023 07:29

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;
};

Ответить
@yashrajbharti9302
@yashrajbharti9302 - 01.01.2023 07:22

const MISSING = (nums, lower, upper) => {
let arr = [];
for (let i = lower; i <= upper; i++) {
if (nums.indexOf(i) == -1) {
arr[i] = i;
}
}
return arr;
};

Ответить
@shibmobileverse468
@shibmobileverse468 - 15.11.2022 23:21

Your videos are good just the volume is so soo low.

Ответить
@Ericsicons
@Ericsicons - 22.10.2022 04:45

What about the case if there's a duplicate number in the array do we need to resort to the hashing or sorting method?

Ответить
@emmannweb
@emmannweb - 11.07.2022 05:58

thanks for you work, seems like this solution not passing all the test for ex: [1,2,3,4,3], could you verify again?

Ответить
@AM-nv4ol
@AM-nv4ol - 15.06.2022 03:30

awesome video, thanks andy!

Ответить
@Elator11777
@Elator11777 - 07.05.2022 12:38

Thank you. Excellent explanation!

Ответить
@diegofss11
@diegofss11 - 28.01.2022 01:48

Nice! Which website do you draw on?

Ответить
@user-sf2sk7zt1l
@user-sf2sk7zt1l - 04.12.2021 01:17

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(:

Ответить
@farihamohamed157
@farihamohamed157 - 07.10.2021 19:54

Thank you for explaining this so clearly!

Ответить