Skip to content

Glossary: Coding Interviews in Rust

saturating_add / saturating_sub

Also written: saturating_add, saturating_sub

Rust arithmetic that stops at the type's limit instead of overflowing. The DP code uses `saturating_add(1)` so "infinity plus one" stays infinity.

Where the book teaches it

Related terms

INF (u32::MAX)Panic