The Add Two Integers interview question is arguably the simplest problem in technical interviews. Given two integers num1 and num2, you are asked to return their sum.
While it seems trivial, it is often used as a "smoke test" or a way to get a candidate comfortable with the coding environment. At companies like Apple or Atlassian, it might be used to discuss bitwise operations (how addition works at the hardware level) or to test basic syntax in a new language.
This uses the basic Math interview pattern. In most cases, you simply use the + operator. In advanced variations, you might be asked to solve it using Bit Manipulation (using XOR for addition and AND with a bit shift for carries).
If num1 = 12 and num2 = 5, the sum is .
If using bit manipulation:
int values might exceed the 32-bit limit, though modern interview platforms usually account for this.If you receive this in a high-stakes interview, assume the interviewer might want to pivot into "How would you do this without the + operator?" Be ready to discuss the bitwise logic of a Half Adder or Full Adder.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Calculate Money in Leetcode Bank | Easy | Solve | |
| Perfect Number | Easy | Solve | |
| Ugly Number | Easy | Solve | |
| A Number After a Double Reversal | Easy | Solve | |
| Convert the Temperature | Easy | Solve |