随笔分类 -  Easy

简单难度
摘要:给定一个整型数组,找出主元素,它在数组中的出现次数严格大于数组元素个数的二分之一。 You may assume that the array is non-empty and the majority number always exist in the array. You may assume 阅读全文
posted @ 2017-12-18 10:01 Tom_NCU 阅读(80) 评论(0) 推荐(0)
摘要:如果要将整数A转换为B,需要改变多少个bit位? 注意事项 Both n and m are 32-bit integers. 样例 如把31转换为14,需要改变2个bit位。 (31)10=(11111)2 (14)10=(01110)2 按位与,非0累计 class Solution: """ 阅读全文
posted @ 2017-12-14 11:07 Tom_NCU 阅读(152) 评论(0) 推荐(0)