Subtree of Another Tree - Leetcode 572 - Trees (Python)

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

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 12
@GregHogg
@GregHogg 4 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@christianjt7018
@christianjt7018 3 ай бұрын
Great solution! I suggest a minor optimization: check the subtree only if the node and the head of the subroot have the same value.
@franciscoserra8455
@franciscoserra8455 Ай бұрын
I tested that out and the difference was minus 4 ms on average, so that's really really really a minor optimization that I would disregard in order to prioritize code readability :)
@LemesaElias
@LemesaElias 2 ай бұрын
I like how you approach problems and how you don't use some weird built-in functions. Everything is clear and understandable.
@jacky-L-327
@jacky-L-327 6 ай бұрын
what’s the m + n solution
@GregHogg
@GregHogg 6 ай бұрын
You can read about it in the leetcode editorial section, it's kinda weird
@aly7401
@aly7401 5 ай бұрын
Thank you for your tree-based problems video 🎉
@saideep7510
@saideep7510 22 күн бұрын
@@GregHogg But would this (m*n) solution be good enough for faang interview or would we be expected to know (m+n) solution as well?
@youngbaron1504
@youngbaron1504 17 күн бұрын
@@saideep7510i think m+n is very advanced
@piglovesasy
@piglovesasy 2 ай бұрын
this does not feel like an easy problem, more like a medium
@praneetkomandur6576
@praneetkomandur6576 4 ай бұрын
do we need to really know about the time complexity of every leetcode problem we solve
@GregHogg
@GregHogg 4 ай бұрын
Yes
Pacific Atlantic Water Flow - Leetcode 417 - Graphs (Python)
17:10
Thank you Santa
00:13
Nadir Show
Рет қаралды 35 МЛН
This Game Is Wild...
00:19
MrBeast
Рет қаралды 185 МЛН
Subtree of Another Tree - Leetcode 572 - Python
14:15
NeetCode
Рет қаралды 171 М.
Diameter of Binary Tree - Leetcode 543 - Trees (Python)
11:16
Coin Change - Leetcode 322 - Dynamic Programming (Python)
15:27
Recursive Backtracking - DSA Course in Python Lecture 14
12:58
The Truth About Learning Python in 2024
9:38
Internet Made Coder
Рет қаралды 216 М.
Starting a Career in Data Science (10 Thing I Wish I Knew…)
10:42
Sundas Khalid
Рет қаралды 238 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 124 М.
Clone Graph - Leetcode 133 - Graphs (Python)
13:38
Greg Hogg
Рет қаралды 3,9 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 35 МЛН