Python Leetcode Solution 15: 3Sum

preview_player
Показать описание
Return a list containing 3-variable lists which sums up to 0 without repetition.

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

Sorry for my 2 mistakes in video and I have corrected them in my github code.
1. In the first beginning for loop, it should be " for i in range(length-1)" instead of range(length-2). It is because length has already minus 1 before.
2. 2 while loops should shift "j<k" sequence to front like "while j < k and nums[j] == nums[j+1]" since if j happens to be the last item in the list then there will be a mistake because nums[j+1] does not exist. By shifting j<k in front, we can make sure that j won't be the last item in list since j must smaller than k first in order to check the next condition "nums[j] == nums[j+1]".

NianLi
Автор

Hello thank for the video. if not temp: i am not sure why temp is 0?

robinseoseo
Автор

Can you please make a video about Delete Node in a Linked List, and Remove Nth Node From End of List.

robinseoseo
join shbcf.ru