"Sometimes the easiest problems teach the most important lesson: keep your solution as simple as the problem itself."
Problem
Given two integers num1 and num2, return their sum.
Example
Input: num1 = 12, num2 = 5
Output: 17
Intuition
The problem directly asks us to add two numbers.
No special data structures, algorithms, or edge cases are required.
Simply return:
num1 + num2
Approach
Take num1 and num2.
Add them together.
Return the result.
💻 Java Solution
class Solution {
public int sum(int num1, int num2) {
return num1 + num2;
}
}
Complexity Analysis
Time Complexity
O(1)
Only one addition operation is performed.
Space Complexity
O(1)
No extra space is used.
Interview Takeaway
Although this problem is simple, it helps beginners understand:
✅ Function implementation
✅ Method return values
✅ Input and output handling
✅ Basic arithmetic operations
Every coding journey starts with a single problem. Keep solving consistently and the hard problems will eventually feel easy.
⭐ Follow for more LeetCode exp```
Code block