Visual introduction Two Pointer Algorithm | Data Structure and Algorithm for Coding Interviews

  Рет қаралды 85,832

Josh's DevBox

Josh's DevBox

Күн бұрын

Пікірлер: 38
@shahoriarfahim3679
@shahoriarfahim3679 Ай бұрын
This is probably the best video I've seen on coding interviews. It covers: 1. Precise, insightful questions 2. Concise, targeted answers with helpful tips 3. Clear, visually appealing graphics and examples that make complex topics easy to understand 4. A real-world example and code walkthrough to demonstrate the solution in action
@Sailgodgreenearth
@Sailgodgreenearth 2 жыл бұрын
The best part of this video is showing how to identify where to apply it. Great Explanation overall
@tribaldeni
@tribaldeni Жыл бұрын
Thanks for explaining perfectly. You were talking about asking the interviewer or using another ds. I came up with another solution, especially if it’s not sorted it’s technically O(n) . You convert the array to an object/hash map , you map the number to index and then loop over the array, you minus the target from the number at array index where your loop is currently at, you try to get if you can then return the indexes. It’s O(n+n) which is 0(n). But two pointers is totally better
@rajatsharma6597
@rajatsharma6597 11 ай бұрын
nice visualisation and great technique with binary search
@aditya9896
@aditya9896 5 ай бұрын
This was the best explanation for me, understanding to approach a problem and optimising it later is the key, Thank you for showing the application on solution very helpful, subbed
@JananiVA
@JananiVA 18 күн бұрын
Awesome Explanation.
@zacherywagner1189
@zacherywagner1189 7 ай бұрын
O(N) is not > than O(N Log n)
@anishbhalla5101
@anishbhalla5101 4 ай бұрын
I think he meant O(N^2) > O(N logn))
@lalalanding234
@lalalanding234 2 ай бұрын
No ​@@anishbhalla5101
@wandilencongwane3621
@wandilencongwane3621 Ай бұрын
Mybe they just meant greater time efficiency
@slime_king5324
@slime_king5324 Ай бұрын
They put in there in a sense that is better. But yeah it's very ambiguous.
@surya.r3463
@surya.r3463 10 ай бұрын
thank you so much sir Such a great and simple way of explanation
@brianwsmithers
@brianwsmithers 5 ай бұрын
Thanks for the video. I enjoyed the explanation. My only recommendation would be for you to run the coding example in an IDE using the debugger. It would be easier to visualize each step of the algorithm since the operations would appear on screen.
@HR-pz7ts
@HR-pz7ts Жыл бұрын
This code is clean and makes so much sense. Thank you for sharing!
@sampreethadixith980
@sampreethadixith980 Ай бұрын
Brilliant explanation!!
@yankomirov4290
@yankomirov4290 8 ай бұрын
This was very well explained, thanks!
@Frizen88
@Frizen88 11 ай бұрын
the rum time animation in 4:37 is not accurate shouldn't move the front pointer until the current sum is smaller then target, as your code says. but nice video, thanks
@pascal9814
@pascal9814 8 ай бұрын
Yes
@uknow2908
@uknow2908 2 жыл бұрын
Thank you very much. Very descriptive video!
@12371eric
@12371eric Жыл бұрын
I'm fairly new to this concept, I understand that you return an array of size 2 with the current index locations of the 2 values that equal our sum. However, I don't understand why you add one to these indexes? I solved this problem in Java and adding one to the indexes returned the wrong value. Is this just how the language you are using functions?
@bocbinsgames6745
@bocbinsgames6745 Жыл бұрын
That's how the leetcode question is worded.
@ajmdz
@ajmdz 2 жыл бұрын
Hi. What software do you use for these visualizations? It looks a lot like 3blue1brown's
@elixpo
@elixpo Жыл бұрын
It's manim, a python library
@darkknight3929
@darkknight3929 4 ай бұрын
great one
@omj7113
@omj7113 10 ай бұрын
Thank you! It helps!😊
@marioprado8789
@marioprado8789 Жыл бұрын
Thanks!, Logré resolver el problema de los contenedores de agua luego de ver su video.
@louievasquez6009
@louievasquez6009 2 жыл бұрын
when returning the two indicies, why add 1 to both? 2 and 7 were at indexes 0 and 1 respectively so confused why you have to add the 1
@Meeko1123
@Meeko1123 2 жыл бұрын
I was really confused too. The problem has a note "Your returned answers (both index1 and index2) are not zero-based." so I think they're adding 1 to account for this note. It's a weird note, though.
@aadhuu
@aadhuu Жыл бұрын
@@Meeko1123 yup look at the first example. [1,2] was the answer
@gunahawk6893
@gunahawk6893 2 жыл бұрын
Great one
@davidtran7609
@davidtran7609 4 жыл бұрын
Can you go topological sort next?
@JoshsDevBox
@JoshsDevBox 4 жыл бұрын
Thanks for the suggestion! You'll be happy to know that it is in the backlog of topics that we will cover in the future!
@bullymaguire2335
@bullymaguire2335 22 күн бұрын
i didnot understand the binsearch solution at all can someone explain
@Nani-cf3sw
@Nani-cf3sw 2 жыл бұрын
It will work only for unique elements
@kundan_28
@kundan_28 Ай бұрын
Good explanation. But you should have more animations to track the different variables you're describing. Also, the two people talking thing isn't good.
@pandi5893
@pandi5893 2 ай бұрын
if 3Brown1Blue made coding videos
@wizardgaming163
@wizardgaming163 5 ай бұрын
This was the worst video
@lalalanding234
@lalalanding234 2 ай бұрын
Usually the base is less than 4. So for higher values n, n*log(n) becomes greater than n. And that is why O(nlogn) > O(n). * From Google *
Two Pointer Approach - CP TacTics | Two Sum Problem | The Code Mate
15:45
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 367 М.
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 674 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 536 М.
How to Use the Two Pointer Technique
10:56
Team AlgoDaily
Рет қаралды 115 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 461 М.
Two Pointer Algorithm | Two Sum Problem | Solve DS Problems in O(N) Time
19:18
JAVAAID - Coding Interview Preparation
Рет қаралды 122 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
you will never ask about pointers again after watching this video
8:03
L1. Introduction to Sliding Window and 2 Pointers | Templates | Patterns
36:55
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,3 МЛН
LeetCode: The Worst Thing to Happen to Software Engineering
8:03
Coding with Dee
Рет қаралды 151 М.
#behindthescenes @CrissaJackson
0:11
Happy Kelli
Рет қаралды 27 МЛН