2235. Add Two Integers
Intuition
I first looked at the inputs that are given to the program. I walked through a simple version of the problem in my head and then in pseudocode.
Approach
I take the 2 inputs, add them together, and return the sum.
Complexity
Time complexity:
O(1)Space complexity:
O(1)
Code
GitHub: https://github.com/Verisimilitude11/LeetCode-Problems/tree/main/2235.%20Add%20Two%20Integers
class Solution {
public int sum(int num1, int num2) {
return num1 + num2;
}
}
Top comments (0)