Add Two Integers - Problem
Given two integers num1 and num2, return the sum of the two integers.
Constraints:
- -100 ≤ num1, num2 ≤ 100
Input & Output
Example 1 — Basic Addition
$
Input:
num1 = 12, num2 = 5
›
Output:
17
💡 Note:
Simply add the two integers: 12 + 5 = 17
Example 2 — Negative Numbers
$
Input:
num1 = -10, num2 = 4
›
Output:
-6
💡 Note:
Adding a positive to a negative: -10 + 4 = -6
Example 3 — Both Negative
$
Input:
num1 = -1, num2 = -1
›
Output:
-2
💡 Note:
Adding two negatives: -1 + (-1) = -2
Constraints
- -100 ≤ num1, num2 ≤ 100
Visualization
Tap to expand
Understanding the Visualization
1
Input
Two integers: num1 = 12, num2 = 5
2
Process
Add the integers using + operator
3
Output
Return the sum: 17
Key Takeaway
🎯 Key Insight: Integer addition is already optimized - use the + operator directly
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code