Linkedin

6 articles

dsa8 min read

Odd Even Linked List — Two-Chain In-Place Grouping Explained

LC 328 Odd Even Linked List is a medium interview problem at Facebook, Amazon, and LinkedIn that tests your ability to maintain two separate pointer chains simultaneously. Learn the O(1) space two-chain pattern with Python and JavaScript, a visual dry run, and interview tips.

Read →
dsa7 min read

Evaluate Reverse Polish Notation — Operand Stack Calculator

Evaluate a Reverse Polish Notation expression by pushing operands and applying operators to the top two stack elements in O(n) time. The canonical stack-based expression evaluation problem asked at Amazon, LinkedIn, and Microsoft.

Read →
dsa5 min read

Find Leaves of Binary Tree — LC 366 Height-Based Grouping

LC 366 Find Leaves of Binary Tree groups nodes by their height (distance from the nearest leaf) using a post-order DFS — a problem asked at Amazon and LinkedIn that reveals an elegant alternative to iterative leaf removal.

Read →
dsa5 min read

Binary Tree Upside Down — Re-root the Left Spine in O(n)

LeetCode 156 (Medium) classically asked at Google and LinkedIn. Re-root a binary tree by flipping each left child into the new parent and the original parent into the new right child, in O(n) time and O(1) extra space iteratively.

Read →