Minimum Absolute Difference in BST - Leetcode 530 - Trees (Python)

preview_player
Показать описание


Please check my playlists for free DSA problem solutions:

My Favorite Courses:

Data Structures & Algorithms:

Python:

Web Dev / Full Stack:

Cloud Development:

Game Development:

SQL & Data Science:

Machine Learning & AI:
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

You can also improve performance by flattening the tree in a sorted array using Inorder traversal and then just sliding a constant window of length 2 maintaining the minimum absolute difference

saurabhbhagat
Автор

Thank you so much man, after your explanation I was able to code on my own :)

tanzimchowdhury
Автор

Question: Is there a reason to use the list trick to make the variables global, rather than using the 'nonlocal' keyword?
Thank you for the video. 👍

dm
Автор

Gregg quick question do we still need to solve leetcode questions for data science job roles?

shreehari
Автор

First! Can't believe it! Thank you for your videos man! Made me get into python. Ease of use >>>

livelaughlove_h
Автор

How would this algorithm derive the correct answer if 24 was 21? It should still be a difference of 1 from the root 20 difference but its only getting compared to the 25 node. Would this algorithm not return a min value of 2 (17-15) instead of 1 (21-20)?

nhatho
Автор

Why did you make max_distance and prev a list?

neilgibbons
join shbcf.ru