Skip to main content

Practice ยท 1 of 1

Overflow-Safe Addition

Implement addChecked: returns the sum, or std::nullopt when it would overflow โ€” for every signed combination, including INT_MAX/INT_MIN extremes. No signed overflow may occur in your implementation (pre-check, don't post-detect).

Difficulty: advanced

Back to lesson: Practice: Practice: Checked Boundaries