371. Sum of Two Integers

来源:互联网 发布:下载蜜蜂软件 编辑:程序博客网 时间:2024/06/06 02:08

371. Sum of Two Integers

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.

解1:
厉害了,不使用加减,计算两个整数的和。
那么是否可以使用operator模块中的add,好贱啊,哈哈哈, 居然通过了,机智如我。

class Solution(object):    def getSum(self, a, b):        """        :type a: int        :type b: int        :rtype: int        """        return operator.add(a,b)
0 0
原创粉丝点击