diff options
author | Jack Sangdahl <[email protected]> | 2025-03-10 18:40:27 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-03-10 18:40:27 -0600 |
commit | 8f4256dd97fe3ad442443201a9b893de80859c96 (patch) | |
tree | 2fd76ebb77981d0eb9c3b6e05f702315f947fa80 /sum_two_integers.py | |
parent | c4dfb6db4f4375729b28bd39fc90cb385b482b3d (diff) | |
download | leetcode-8f4256dd97fe3ad442443201a9b893de80859c96.tar.gz leetcode-8f4256dd97fe3ad442443201a9b893de80859c96.zip |
371. sum of two integers
Diffstat (limited to 'sum_two_integers.py')
-rw-r--r-- | sum_two_integers.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sum_two_integers.py b/sum_two_integers.py new file mode 100644 index 0000000..1ed3424 --- /dev/null +++ b/sum_two_integers.py @@ -0,0 +1,23 @@ +# 371. Sum of Two Integers + +""" +given two integers 'a' and 'b', return the sum of the two integers without +using the operators '+' and '-'. +""" + + +class Solution(object): + def getSum(self, a, b): + """ + :type a: int + :type b: int + :rtype: int + """ + ab = [a, b] + return sum(ab) + + +if __name__ == "__main__": + obj = Solution() + print(obj.getSum(a=1, b=2)) + print(obj.getSum(a=2, b=3)) |