Can You Detect the Missing Numbers? (LeetCode 448: Find All Numbers Disappeared in an Array)

  Рет қаралды 373

Code With Zi

Code With Zi

Күн бұрын

Пікірлер: 5
@davidcalloway9062
@davidcalloway9062 Ай бұрын
This was way cooler than the way that first came to mind!
@CodeWithZi
@CodeWithZi Ай бұрын
Thanks for your supportive comment!
@KarthikB-gy3oq
@KarthikB-gy3oq Ай бұрын
Use cyclic sort
@davidcalloway9062
@davidcalloway9062 Ай бұрын
Also while watching it occurs to me that you could reuse the original array to write the missing numbers to by keeping an index of the next available position as you go through checking for positive numbers. In Go for example this would avoid additional allocation and potentially resizing the slice.
@CodeWithZi
@CodeWithZi Ай бұрын
Awesome approach! it can indeed optimize the memory usage
Can You Find Minimum in Stack? (LeetCode 155: Min Stack)
7:48
Confronting Ronaldo
00:21
MrBeast
Рет қаралды 27 МЛН
УДИВИЛ ВСЕХ СВОИМ УХОДОМ!😳 #shorts
00:49
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
Minimum Number of Removals to Make Mountain Array - Leetcode
10:10
ThinkOutsideTheBox
Рет қаралды 37
Can You Generate Subsets? (LeetCode 90: Subsets II)
11:52
Code With Zi
Рет қаралды 284
Only Geniuses Can Solve This | A Challenging Exponential Equation
10:46
Why I Chose Copywriting as a Beginner
9:08
Harleen Saini
Рет қаралды 523
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 4,1 М.
Confronting Ronaldo
00:21
MrBeast
Рет қаралды 27 МЛН