Skip to content

Glossary: Coding Interviews in Go

Greedy

Also written: greedy algorithm

Taking the best-looking choice at each step. It only works for some problems: for 13 lb with bags of 2, 5 and 6, greedy fails but dynamic programming succeeds.

Where the book teaches it

Related terms

Dynamic programming (DP)