2017年9月30日
摘要: Experience is a hard teacher because she gives the test first, the lesson afterwards.经验就像一个很严格的老师,因为她总是先给我们以考验,然后再给我们上课。 阅读全文
posted @ 2017-09-30 14:08 loveLifeloveSport 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 计算在一个 32 位的整数的二进制表示中有多少个 1? 思路: 1、首先判断整数正负; 2、循环31次,每次循环对整数进行无符号右移(>>>),然后判断整数的二进制表示的最后一位是否为1? public class Solution { public int countOnes(int num) { 阅读全文
posted @ 2017-09-30 11:10 loveLifeloveSport 阅读(348) 评论(0) 推荐(0) 编辑