Master Data Structures & Algorithms For FREE at AlgoMap.io!
@christianjt70183 ай бұрын
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Ай бұрын
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 :)
@LemesaElias2 ай бұрын
I like how you approach problems and how you don't use some weird built-in functions. Everything is clear and understandable.
@jacky-L-3276 ай бұрын
what’s the m + n solution
@GregHogg6 ай бұрын
You can read about it in the leetcode editorial section, it's kinda weird
@aly74015 ай бұрын
Thank you for your tree-based problems video 🎉
@saideep751022 күн бұрын
@@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?
@youngbaron150417 күн бұрын
@@saideep7510i think m+n is very advanced
@piglovesasy2 ай бұрын
this does not feel like an easy problem, more like a medium
@praneetkomandur65764 ай бұрын
do we need to really know about the time complexity of every leetcode problem we solve