Kth Smallest Element in a BST (python) - Day 20/31 Leetcode May Challenge

preview_player
Показать описание
Larry solves and analyzes this Leetcode problem as both an interviewer and an interviewee. This is a live recording of a real engineer solving a problem live - no cuts or edits!

#leetcode #coding #python #programming
Рекомендации по теме
Комментарии
Автор

I used in order traversal and passed a list by reference. Every visit I push on the list. And when the list is of size k, I just return from the dfs, and return the last element on the list.

bethsuni
Автор

i just kept counter of nodes seen in the in order traversal

hellowill
Автор

What strategy would you use to attack the followup questions?

Algorithmist
visit shbcf.ru