Find All Numbers Disappeared in an Array - LeetCode 448 - Python [O(n) time and O(1) Space!]
Vložit
- čas přidán 14. 01. 2020
- If this HELPED at all, check out my channel for even **MORE VIDEOS**!!:)) czcams.com/users/DEEPTITALES...
Explaining how to solve Find All Numbers Disappeared in an Array in Python - LeetCode 448!
Music: Bensound
Code: github.com/deepti-talesra/Lee...
Let me know if you have any questions!:) - Věda a technologie
this is the best walkthrough of this problem, thanks!
finally I found the best approach for this question.Thanks !!!
Yay, glad it was helpful Akash!!:))
Thank you, greatest and most simple explanation I could find anywhere!
Thank you so much!!!:))
I finally understood this now, thank you so much!!
yay so glad to hear it Pratyaksh!!:)
GREAT EXPLANATION!!!!! KEEP POSTING MORE SUCH QUESTIONS !!
Thank you sm!:) more coming soon!
Concise and useful explanation, much appreciated!
Thank you so much Mike!:))
awesome, thanks a lot, this thought process has already unlocked some other array problems like
"finding the duplicate numbers in an array" and so on. but what if the array was immutable?
nice explanation, made it easy to understand
Glad to hear that!:)
Very nice! Can you kindly let me know what algorithm you use for solving this problem? I would like a further research.
Thank you! I'm not sure if there is a name for this type of approach, or if there is, I'm not aware of it. If I do find out more however, I'll comment below!
Excellent Logic.
Thank you!:)
Amazing!
:))
amazing explanation
Thanks so much Deep!:))
i loved the way you teach mam
Aw thanks so much Tanish!:)
Here's how I implemented in java if someone is using java (very good explanation btw)
class Solution {
public List findDisappearedNumbers(int[] nums) {
List list = new ArrayList();
for(int i = 0; i < nums.length; i++){
int pos = Math.abs(nums[i])-1;
nums[pos] = -Math.abs(nums[pos]);
}
for(int i = 0; i < nums.length; i++){
if(nums[i] >= 0) list.add(i+1);
}
return list;
}
}
Runtime: 5 ms, faster than 83.36% of Java online submissions for Find All Numbers Disappeared in an Array.
Memory Usage: 48.2 MB, less than 37.74% of Java online submissions for Find All Numbers Disappeared in an Array.
great! we need more videos :)
Yesssir and ty Aniket!! :)
Hey, great explanation and logic. Just a little suggestion, if you are creating a logic or using a specific algorithm, can you use comments to highlight which part of code executes specific logic. Also as you started this channel sometime back, maybe a github repo to maintain code and explanation for further reading can be great help. Thanks. Also you can use enumerate(iterable, start=1) to go through indices that start from 1 instead of 0.
Thank you! I’ll look into documenting the code somehow, repo or otherwise (maybe in the description?). And yeah doing enumerate starting from 1 would make it clearer!
just for Prathamesh: github.com/deepti-talesra/LeetCode
all my code uploaded on github - hope this makes it easier and helps:)
@@DEEPTITALESRA Thanks, is it okay to contribute? Definitely can help it look more readable with explanation and other text?
intuitive and simple explanation srsly
aww thank you sm!!:)
can you plz do 289. Game of Life
?
Zoom in the screen before teaching pls 🤗🤗
Haha yess def increasing font in newer vids!!:)