Cyclic-sort

1 articles

dsa17 min read

First Missing Positive [Hard] — The Definitive Index-Marking Guide [Amazon, Google, Microsoft]

LeetCode 41 is a landmark Hard problem because both obvious approaches — hash set and sorting — are explicitly banned by the constraints. Learn the mathematical insight that bounds the answer to [1, n+1], then master two O(n) time, O(1) space techniques: index marking via sign negation and cyclic sort placement, with a full visual dry run, bug catalogue, and FAANG follow-ups.

Read →