Back to problems Sign in to unlock
Leetcode
Easy
Math
Functions
Add Two Integers
Return the sum of two integers.
Acceptance 0%
Problem Statement
Add Two Integers
Given two integers num1 and num2, compute and return their sum.
This is a basic warm-up problem meant to check whether you can read the inputs correctly and produce the correct arithmetic result.
Input Format
- Two integers
num1andnum2. - They may be positive, negative, or zero.
Output Format
- Return a single integer equal to
num1 + num2.
Constraints
- The inputs are integers.
- No special edge handling is required beyond normal integer addition.
Examples
Sample cases returned by the problem API.
Example 1
Input
num1 = 12, num2 = 5
Output
17
Explanation
The sum of 12 and 5 is 17.
Example 2
Input
num1 = -3, num2 = 7
Output
4
Explanation
Adding a negative number and a positive number gives 4.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.
Guided hints
Editorial and discussion links
Concept map and variants
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.