Problem
Problem Solving Approach
- This problem tests the ability to perform simple arithmetic operations and return the result.
- The parentheses () are not necessary to use, considering Java operator precedence.
Reference
Github Link
https://github.com/eunhanlee/LeetCode_2235_AddTwoIntegers_Solution.git
Time Complexity: O(1), Space Complexity: O(1)
class Solution {
/**
* Returns the sum of two integers.
*
* @param num1 The first integer.
* @param num2 The second integer.
* @return The sum of num1 and num2.
*/
public int sum(int num1, int num2) {
return num1 + num2;
}
}
댓글 없음:
댓글 쓰기