摘要: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the ... 阅读全文
posted @ 2015-11-16 16:12 0giant 阅读(201) 评论(0) 推荐(0) 编辑
摘要: ---恢复内容开始---【一】一共有n个人,有m条跳绳,我们如何分配组以及组员数,使得每组的人数相差最少,例如输入9个人,8条跳绳,最佳分配是5,4;刚开始并没有理解题的意思,情急之下,百度为上。看到一道和这道题非常类似的题目。输入两个数,人数为n,跳绳数为m。首先,加入人数小于m分成1组就好了,如... 阅读全文
posted @ 2015-11-16 13:07 0giant 阅读(531) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit i... 阅读全文
posted @ 2015-11-16 10:23 0giant 阅读(157) 评论(0) 推荐(0) 编辑