[Java] Leetcode 15/16/259 Three Sum Problem [Two Pointers #6]

preview_player
Показать описание
In this video, I'm going to show you how to solve Leetcode 15/16/259 Three Sum Problem which is related to Two Pointers.

Here’s a quick rundown of what you’re about to learn:

⭐️ Contents ⭐️
⌨️ (0:00) Intro
⌨️ (0:21) Leetcode 15 3Sum
⌨️ (10:12) Leetcode 16 3Sum Closest
⌨️ (17:08) Leetcode 259 3Sum Smaller

In the end, you’ll have a really good understanding on how to solve Leetcode 15/16/259 Three Sum Problem and questions that are similar to this Two Pointers.

Рекомендации по теме
Комментарии
Автор

Playlists by pattern and phase are just awesome. It will help many folks to get started with leetcode problems. Thank you!

fagunpatel
Автор

Nice explanation Sir. Keep update us with few more tricky problems.

mohdasim
Автор

Eric, is there specific reason for choosing to use a Linked List?

DylanL
Автор

wow i never knew about the keyword "continue" so that was an interesting one to know.

Rob-J-BJJ
Автор

Thank you Eric . I love your videos! Can you tell me the space complexity please.

theceo
Автор

Can you explain why for the 2 two inner while loops you have L < R, wouldnt the outer while loop take care of that?

Rob-J-BJJ
Автор

i have walked throught the code on pen and paper. but how did you deduce the counter from the first place .

abedalraoufzeidan
Автор

you need to explain why on line 13 we check with previous element and continue. because of duplicates.

needtubes
Автор

I'm not clear at "counter += R - L". In my mind when curSum < target we should counter = counter + 1, right? . Please help me realize it. Thank you.

johnsnow
Автор

Can someone let me know, can the curSum of nums i, L R cause overflow?

irisnie
Автор

Why We need to check nums[i] == nums[i-1]? Could you explain a liitle bit in that logic?

johnsnow
Автор

Can someone please tell me that in line number 13, why do we write if i != 0, understood the rest of the condition and also, why can't we use hashset in order to avoid duplicates ?

sakshishah