Two Sum IV - Input is a BST | Leetcode 653 | Live coding session

preview_player
Показать описание
Here is the solution to "Two Sum IV - Input is a BST" leetcode question. Hope you have a great time going through it.

1) 0:00 Explaining the problem out loud
2) 1:10 Algorithm walkthrough
3) 2:30 Solution approach
4) 11:00 Coding and Time Complexity

For discussion/feedback

PS : Please increase the speed to 1.25X
Рекомендации по теме
Комментарии
Автор

Thank you sir ...I got the approach to solve the problem.

codingkaksha
Автор

First time in whole This is the first time my code works in first attempt .

amitbajpai
Автор

Was able to do it on my own, here just to like the video👌

daanishsarguru
Автор

Using a Map instead of Set in the second approach gives a better run time as set.contains() takes an O(n).. since we are performing it on each element of the tree it is O(n^2). Don't you agree? Can use BFS here to avoid recursion fear 😁

tanson
Автор

2nd approach was pretty interesting. good use case of preOrder traversal

sugandhm
Автор

Please upload the solution of last day - Rectangle area II

koulicksadhu
join shbcf.ru