# 3Sum

> LeetCode #15 — 3Sum. Solve on LeetCode, then implement here if you want it in your drill queue.

https://leetcode.com/problems/3sum/

Canonical: https://learn.significanthobbies.com/curriculum/drills/lc-3sum

LeetCode #15 — 3Sum. Solve on LeetCode, then implement here if you want it in your drill queue.

https://leetcode.com/problems/3sum/

## The mechanism

Two pointers replace a nested loop with a single pass by exploiting structure — usually a sorted array or a sequence with a monotonic property. The pointers move toward or away from each other based on a comparison, so each element is visited once.

## Expected evidence

Pass all LeetCode test cases for this problem.

## Hints

- Pattern hint: two pointers.
- Start with brute force, then optimize time/space.
- Write down invariants before coding.

## Sources and practice

- [NeetCode Roadmap](https://neetcode.io/roadmap)
- [Two Pointers — USACO Guide (Silver)](https://usaco.guide/silver/two-pointers)
- [cp-algorithms — Tortoise and Hare (linked list cycle detection)](https://cp-algorithms.com/others/tortoise_and_hare.html)
- [Study Two Pointers](https://learn.significanthobbies.com/curriculum/concepts/two-pointers)
- [Try the interactive drill](https://learn.significanthobbies.com/drills/lc-3sum)
- [All practice briefs](https://learn.significanthobbies.com/curriculum/drills/)
