Practice Add Two Integers
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Return num1 + num2 for the supplied pair of integers. Negative inputs and zero use ordinary signed addition. Practice approach: This task needs one addition, not string conversion, carry simulation, or a linked list. With the stated bounds, the result fits in a signed 32-bit integer. Time and extra space are both O(1). Test opposite signs, two negatives, and a zero operand.
Source: Add Two Integers on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
num1 = 12, num2 = 5
17
# Example 2
num1 = -10, num2 = 4
-6
Constraints
Related LeetCode Problems
Practice more problems similar to Add Two Integers.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.