Reorder List | Leet code 143 | Theory explained + Python code

  Рет қаралды 3,192

Sai Anish Malla

Sai Anish Malla

Күн бұрын

Пікірлер: 18
@SteveWoznokav
@SteveWoznokav 3 жыл бұрын
I liked your approach. Most people use dynamic programming for the solution but you applied both, stack+ queue for the solution. On the leetcode website, this question is under stacks therefore your solution is okay but if the interviewer is an as..... he may tell you ,you used stacks and queues at the same time since you pop from the left(popleft() used for queue) so the answer will not be valid if the interviewer asks you to use only stacks so also try ONLY popping the last element in the array/List. What i am saying is that it is very important to have multiple solutions for a problem, try to solve it using only stacks. But i loved your solution....
@saleheen1
@saleheen1 Ай бұрын
That was super helpful and easy to understand
@carpedim24
@carpedim24 Жыл бұрын
Great explanation, I have a series request for you , Can you please make videos on data structures implemented in python???
@rohitmujumdar8195
@rohitmujumdar8195 3 жыл бұрын
Haven't they asked us to do this in place? Can we employ another data structure here (eg. queue)?
@ppippiminiverse4040
@ppippiminiverse4040 3 жыл бұрын
Your explanation is crystal clear. Superb!!!
@saianishmalla2646
@saianishmalla2646 3 жыл бұрын
Thanks a lot glad it helps
@krishnaharshith9854
@krishnaharshith9854 2 жыл бұрын
Excellent explanation man. Really loved it!!
@pythonenthusiast9292
@pythonenthusiast9292 4 жыл бұрын
great explanation, I have a series request for you , Can you please make videos on data structures implemented in python? it would be awesome man!
@saianishmalla2646
@saianishmalla2646 4 жыл бұрын
Thank you! And actually I have been planning on doing thing right now I wanted tk start off by doing sorting algorithms from there I'll do data structure and so on.
@pythonenthusiast9292
@pythonenthusiast9292 4 жыл бұрын
@@saianishmalla2646 great !
@praneetkomandur6576
@praneetkomandur6576 4 ай бұрын
great vid
@gastonjarju1370
@gastonjarju1370 4 жыл бұрын
Great explanation!
@saianishmalla2646
@saianishmalla2646 3 жыл бұрын
Thank you! glad it helped!
@dddddddddr
@dddddddddr 2 жыл бұрын
Thank you!
@vm7240
@vm7240 2 жыл бұрын
how did you know that there will be a cycle ?
@codedoctor3265
@codedoctor3265 3 жыл бұрын
Space - O(1) Time: O(N) class Solution: def reorderList(self, head: ListNode) -> None: """ Do not return anything, modify head in-place instead. """ fast = slow = head while fast and fast.next: fast = fast.next.next slow = slow.next prev = None cur = slow while cur: next_node = cur.next cur.next = prev prev = cur cur = next_node first = head second = prev while second and second.next: t1 = first.next first.next = second t2 = second.next second.next = t1 first = t1 second = t2
@tapaskumarswain9862
@tapaskumarswain9862 3 жыл бұрын
could u plz explain ur code.. it will be greater man
@anitaiitgn6729
@anitaiitgn6729 3 жыл бұрын
can you this problem without import anything.
Linked List Cycle II | Leet code 142 | Theory explained + Python code
11:34
Reverse Linked List - LeetCode  206 - Python (Iterative and Recursive)
15:53
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 29 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 193 МЛН
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 4,4 МЛН
Reverse Linked List - Leetcode 206 - Linked Lists (Python)
8:02
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 11 М.
Additive Number | LeetCode 306 | Theory + Python code
19:12
Sai Anish Malla
Рет қаралды 1,3 М.
ALL 47 STRING METHODS IN PYTHON EXPLAINED
23:34
Indently
Рет қаралды 142 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 29 МЛН