LeetCode - Algorithms - 2235. Add Two Integers

Maybe the most straightforward problem on leetcode. Super simple. Its intention?

Problem

2235. Add Two Integers

C#

1
2
3
4
5
public class Solution {
public int Sum(int num1, int num2) {
return num1 + num2;
}
}

Submission Detail

  • 262 / 262 test cases passed.
  • Runtime: 25 ms, faster than 86.75% of C# online submissions for Add Two Integers.
  • Memory Usage: 26.7 MB, less than 8.86% of C# online submissions for Add Two Integers.

Java

1
2
3
4
5
class Solution {
public int sum(int num1, int num2) {
return num1 + num2;
}
}

Submission Detail

  • 262 / 262 test cases passed.
  • Runtime: 0 ms, faster than 100.00% of Java online submissions for Add Two Integers.
  • Memory Usage: 40.7 MB, less than 78.42% of Java online submissions for Add Two Integers.

JavaScript

1
2
3
4
5
6
7
8
/**
* @param {number} num1
* @param {number} num2
* @return {number}
*/
var sum = function(num1, num2) {
return num1 + num2;
};

Submission Detail

  • 262 / 262 test cases passed.
  • Runtime: 136 ms, faster than 5.20% of JavaScript online submissions for Add Two Integers.
  • Memory Usage: 41.4 MB, less than 97.69% of JavaScript online submissions for Add Two Integers.