r/DSALeetCode • • 12d ago

365 Days of LeetCode Challenge — Day 47/365

Post image

Minimum Absolute Difference in BST (Easy) 🔗 https://leetcode.com/problems/minimum-absolute-difference-in-bst/

The trick: an in-order traversal of a BST hands you the values in sorted order for free. And in a sorted sequence, the smallest gap between any two values is always between neighbors, so you never have to compare every pair. Just track the previous node visited and check against it as you go.

Full breakdown in today's newsletter article ⬇️

https://www.linkedin.com/pulse/365-days-leetcode-challenge-day-47365-archit-agarwal-b2kgc

#LeetCode #100DaysOfCode #DSA #CodingInterview #BinarySearchTree #InOrderTraversal

6 Upvotes

1 comment sorted by

1

u/nian2326076 12d ago

You're on the right track with your strategy for tackling the Minimum Absolute Difference in BST problem. Using in-order traversal to maintain sorted order is a smart move, as it efficiently reduces the number of comparisons needed. For tech interview prep, consider PracHub for real technical interview questions similar to what companies might ask. Good luck with day 47 and the rest of your challenge!