3Sum (LeetCode) | Interview Question Algorithm Explanation
Vložit
- čas přidán 5. 07. 2024
- Link to the Code:gist.github.com/JyotinderSing...
Link to the question: leetcode.com/problems/3sum/
Link to my GitHub: github.com/JyotinderSingh
Link to my Website: jyotindersingh.com/
Notes:
1. Why don't we use a hashmap as in the original Two Sum problem?
A. This is because we can find a better approach, once we've sorted the array - that allows us to solve the problem with the same (and in some cases better) time complexity, while using CONSTANT SPACE.
2. Why do we run the while loops to skip similar elements?
A. We don't want duplicates in the problem set
Timestamps:
00:00 - Problem Introduction
01:14 - Algorithm Approach
03:07 - Coding Walkthrough
_______________________________________
Some great channels to learn more:
Tushar Roy: / tusharroy2525
Errichto: / @errichto
Nick White: / @nickwhite
Kevin Naughton Jr: / @kevinnaughtonjr - Věda a technologie