Skip to main content

Practice · 1 of 1

Overflow-Safe Addition

CHALLENGE
Difficulty: advanced+25 XP

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).

Back to lesson: Practice: Practice: Checked Boundaries