Тёмный

Binary Search Tree Iterator - Leetcode 173 - Python 

NeetCode
Подписаться 745 тыс.
Просмотров 36 тыс.
50% 1

🚀 neetcode.io/ - A better way to prepare for Coding Interviews
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
Problem Link: leetcode.com/problems/binary-...
0:00 - Read the problem
1:30 - Drawing Explanation
9:47 - Coding Explanation
leetcode 173
This question was identified as an interview question from here: github.com/xizhengszhang/Leet...
#meta #interview #python
Disclosure: Some of the links above may be affiliate links, from which I may earn a small commission.

Наука

Опубликовано:

 

6 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 34   
@lakshyasaharan5348
@lakshyasaharan5348 2 года назад
Your voice so soothing and smooth.
@numberonep5404
@numberonep5404 2 года назад
ikr!!!!!!!
@calebi23
@calebi23 2 года назад
Exactly!
@carloscarrillo201
@carloscarrillo201 2 года назад
You're a good man, NeetCode. Thanks!
@manishk2429
@manishk2429 2 года назад
Me: The perfect intro doesn't exi- NeetCode: Let's write some more NeetCode today Me: (Throws earphones in the air) THERE IT IS !!!
@shantanukumar4081
@shantanukumar4081 2 года назад
Great Explanation !!!
@ChanChan-pg4wu
@ChanChan-pg4wu 2 года назад
You are always very helpful! I wish I could work with you in the future!
@ankitgoel6131
@ankitgoel6131 2 года назад
Omg! Thank you so much! I love your videos Neetcode! Just curious, could you also solve Perfect Rectangles?
@essamobeid1507
@essamobeid1507 2 года назад
amazing solution! thanks a lot for posting:)
@kostaad
@kostaad 2 года назад
I wonder if a yield based solutions with co-routines will be sufficient for an interviewer.
@xjlonelystar
@xjlonelystar 2 года назад
Man U doing more leetcode than me and u already have a job ☠️
@usmanakram5191
@usmanakram5191 2 года назад
Does there exists a solution with O(1) space complexity for this problem?
@charleskorey6515
@charleskorey6515 Год назад
Yes there exists but then you have to do o(n) search everytime and it won’t be an iterator anymore. If you count recursion stack then o(1) is not possible
@ibrahimalshubaily9520
@ibrahimalshubaily9520 2 года назад
Still dont get why does has next work?
@DavidDLee
@DavidDLee Год назад
You CAN do it recursively in Python by writing a Generator function, which uses *yield* and *yield from.* The end result is a very clean in-order recursive traversal that's been consumed sequentially, but with O(h) memory ( O(1) for our own state + O(h) where Python keeps track of the generator state).
@bhanuvarma1239
@bhanuvarma1239 Месяц назад
In the given question they asked that implement in the ""In-order Traversal""...But you did it in the ""pre-Order"" ##In-order traversal 1.left node 2.root node 3.right node 👉👉Please clear my doubt sir🙏🙏
@lucashowes4089
@lucashowes4089 2 года назад
Ik google prolly pays you a bag but they might be wasting your talents. Haven't had online instruction this quality since khan academy
@ngneerin
@ngneerin 8 месяцев назад
This comment ruined his life. Now he does his thing for peanuts
@sprajosh
@sprajosh 6 месяцев назад
@@ngneerin😂😂 I think he’ll figure out what to do with his life
@eva__4380
@eva__4380 2 месяца назад
😂😂😂😂😂​@@ngneerin
@zohahs5276
@zohahs5276 2 года назад
how good one has to be in maths to solve these algos?
@MysteriousIndiaYT
@MysteriousIndiaYT 2 года назад
Bro i am expert in python. But very confused, which career i have to choose for my life. Django Developer vs Data Scientist? Can anyone please guide me. I have little knowledge of both
@Ankit-hs9nb
@Ankit-hs9nb 2 года назад
Be a machine learning engineer I am a Data Scientist with 4 years of experience and now switching to Machine Learning engineer
@sidazhong2019
@sidazhong2019 7 месяцев назад
@@Ankit-hs9nb The Machine Learning engineer minium requirement is PHD.
@dewangpatil4990
@dewangpatil4990 2 года назад
Hello Sir i am a big fan......I have a very important request....... Could you please make solution playlist of Striver's SDE Sheet. Its will be very beneficial for us students
@CommandantNOVA
@CommandantNOVA 2 года назад
A lot of problems on the sheet overlap with the leetcode top 75. There's a top 75 playlist already.
@srx2106
@srx2106 9 месяцев назад
for some reason the constructor keeps going over my head
@harshavardhanveerannanaval8605
@harshavardhanveerannanaval8605 2 года назад
Can someone please verify if it could be done this way? class BSTIterator: def __init__(self, root: Optional[TreeNode]): arr=[] def flatten(root): if(root): flatten(root.left) arr.append(root.val) flatten(root.right) flatten(root) self.arr=arr def next(self) -> int: return(self.arr.pop(0)) def hasNext(self) -> bool: return(self.arr) I just done a inorder traversal before hand and store it in an array
@adriandelfin8047
@adriandelfin8047 2 года назад
How do I cope with so many failures in a few months
@Anon-xz6hu
@Anon-xz6hu 2 года назад
Look at your goals, if you are doing progress, no matter how small, don't give up, learn from failures, see what went wrong, why it went wrong, improve and adapt. Have faith in yourself.
@fawadazhermalik9885
@fawadazhermalik9885 2 года назад
Bro failures are an essential part of life that give us new lessons, which we don't get if we don't fail.
@sidazhong2019
@sidazhong2019 7 месяцев назад
This problem is easy.
Далее
Unique Binary Search Trees II - Leetcode 95 - Python
12:51
⚡️Uylanishim kerak, sovchilikka borasizmi?...😅
00:50
Send this to an artist… 😉 #shortsart
00:19
Просмотров 1,5 млн
Flatten Nested List Iterator - Leetcode 341 - Python
10:14
Binary Search Tree in Python
22:59
Просмотров 46 тыс.
100+ Linux Things you Need to Know
12:23
Просмотров 208 тыс.
Online Stock Span - Leetcode 901 - Python
15:19
Просмотров 29 тыс.
8 patterns to solve 80% Leetcode problems
7:30
Просмотров 223 тыс.
Shift 2D Grid - Leetcode 1260 - Python
10:18
Просмотров 19 тыс.
Diameter of a Binary Tree - Leetcode 543 - Python
15:34
Все Смартфоны vivo Серии V30!
24:54
Просмотров 22 тыс.