Slug: arr-three-sum-01 · Paired reading: Chapter 15
Prompt
fn three_sum(mut nums: Vec<i32>) -> Vec<[i32; 3]> — unique triplets that
sum to zero, each triplet sorted, result sorted. Sort first; fix one index;
two-pointer the rest. Dedup carefully.
The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).
Don’t have the book yet? The landing page stays open — purchase unlocks this gym.
intermediate · order 72
Slug: arr-three-sum-01 · Paired reading: Chapter 15
fn three_sum(mut nums: Vec<i32>) -> Vec<[i32; 3]> — unique triplets that
sum to zero, each triplet sorted, result sorted. Sort first; fix one index;
two-pointer the rest. Dedup carefully.