Skip to content

Latest commit

 

History

History
12 lines (11 loc) · 114 Bytes

面试题65. 不用加减乘除做加法.md

File metadata and controls

12 lines (11 loc) · 114 Bytes
func add(a, b int) int {
	sum := a
	for b != 0 {
		sum = a^b
		b = (a&b)>>1
		a = sum
	}
	return sum
}