17.01. Add Without Plus
Description
Write a function that adds two numbers. You should not use + or any arithmetic operators.
Example:
Input: a = 1, b = 1 Output: 2
Note:
a
andb
may be 0 or negative.- The result fits in 32-bit integer.
Solutions
Solution 1
1 2 3 4 5 6 7 8 9 10 11 12 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|