题解 | #不用加减乘除做加法#
不用加减乘除做加法
https://www.nowcoder.com/practice/59ac416b4b944300b617d4f7f111b215
import java.util.*; public class Solution { public int Add(int num1,int num2) { while(num2 != 0){ int carry = (num1 & num2) << 1; num1 ^= num2; num2 = carry; } return num1; } }#剑指offer##java##算法笔试#
剑指Offer2-Java题解 文章被收录于专栏
剑指offer题解(java版)