Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
- Example 1:
1 |
Input: a = 1, b = 2 |
-Example 2:
1 |
Input: a = -2, b = 3 |
不用 +,-运算符计算两个 int 值的和.
实现
- java
递归位运算
1 |
public int (int a, int b) { |
近期评论