Bloomberg

18 articles

dsa8 min read

Linked List Components — HashSet Membership Count Explained

Count the number of connected components in a linked list defined by a given set of values using a single traversal and O(1) HashSet lookups. A clean O(n) interview problem at Google, Amazon, and Bloomberg that tests your ability to convert a graph concept into a simple linear scan.

Read →
dsa7 min read

Remove Duplicates from Sorted List — Single Pass Pointer Walk Explained

LC 83 Remove Duplicates from Sorted List is a foundational linked list interview problem asked at Bloomberg and Microsoft. Learn the single-pass pointer walk solution with Python and JavaScript, a visual dry run, common traps, and how to extend it to the harder variant (LC 82).

Read →
dsa8 min read

Swap Nodes in Pairs — In-Place Pointer Rewiring Without Swapping Values

LC 24 Swap Nodes in Pairs is a medium linked list interview problem at Microsoft and Bloomberg that tests precise multi-step pointer manipulation. Learn the iterative dummy-head approach and the recursive solution with Python and JavaScript, detailed visual dry run, and interview tips.

Read →
dsa8 min read

Partition List — Two Dummy Head Chains for Stable Partitioning

LC 86 Partition List is a medium interview problem at Bloomberg and Amazon that extends the dummy-head two-chain pattern to partition by value comparison. Learn the stable O(n) solution with Python and JavaScript, visual dry run, and critical edge cases including the tail-cycle trap.

Read →
dsa8 min read

Remove Duplicates from Sorted List II — Delete All Occurrences with Dummy Head

LC 82 Remove Duplicates from Sorted List II is a medium interview problem at Google, Amazon, and Bloomberg where you remove ALL nodes that appear more than once from a sorted list. Learn the dummy-head predecessor skip pattern with Python and JavaScript, step-by-step dry run, and the critical difference from LC 83.

Read →
dsa7 min read

Online Stock Span — Monotonic Stack with Span Accumulation

Calculate the stock price span using a monotonic decreasing stack that stores (price, span) pairs and accumulates spans in O(1) amortized time. A classic streaming design problem that tests span accumulation and the monotonic stack pattern.

Read →