LeetCode 2235. Add Two Integers Java Solution

·

1 min read

Problem

Add Two Integers - LeetCode

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

Understanding Java Operator Precedence

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;
    }
}