We can also do Inorder traversal to make an array (which will be sorted) and then use two pointers to decide if start is closer than end.
@annlaosun62605 ай бұрын
yeah. That is what I am thinking too
@stouser1296Ай бұрын
U deserve way more subs
@rsKayiira2 жыл бұрын
Great video. I wish you had a video for question Closest Binary Search tree Value LC 270 as well. Doing it in optimal time isn't easy
@alibeccio7 ай бұрын
It's a BST, bro. When you are required to find a number in a BST, just use binary search.
@vigneshsivashanmugam5312 жыл бұрын
Really you are doing great. Keep up the work. Expecting lot more content from you. I would suggest you to take unique variety of problems(which we might missed to explore) in different topics along with repeatedly asked questions. Also as a future suggestion, you can have a simple dry run(1-2 mins) with example case before you code. Again saying ,you're doing great.
@crackfaang2 жыл бұрын
In a real interview I most certainly would and I actually tell people to do this as part of my algorithm for answering any interview question. Unfortunately I see the video analytics for these videos and most people just skip to the code so it’s not a good use of my time to dry run it. Anyone who wishes to do so can do it on their own time
@kgdev35252 жыл бұрын
"I don't waste my time with this type of nonsense "😂😂😂 , Love your content bro
@crackfaang2 жыл бұрын
Haha I call it how it is. No need to bullshit you guys 😂
@alibeccio7 ай бұрын
What about the follow up sir? It said to solve it in less than O(n) runtime.
@subee12810 ай бұрын
Thank you so much
@sharathkumar83382 жыл бұрын
Hi Cracking FAANG hope you are doing well. Could you please upload videos on heaps and hashmaps?? i'm kind of weak in those concepts. I have solved more problems on trees and linkedList so far. So trying to focus more on graphs, heaps and hashmaps. In addition to amazon could not even clear first round of samsung R & D 🥲.