
LeetCode
dhown
这个作者很懒,什么都没留下…
展开
-
136 Single Number
问题描述: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it withou原创 2016-09-08 20:21:52 · 433 阅读 · 0 评论 -
371 Sum of Two Integers
问题描述:Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. 问题思路:加法可以拆解成两个步骤:不考虑进位,各位相加;各位计算进位与否。这个过程对十进制和二进制都满足。其中异或运算(半加运算)可实现第一步。第二步是与运算。 1. a和b只有做a原创 2016-09-08 19:48:18 · 369 阅读 · 0 评论