摘要: 1 typedef unsigned int uint32_t; 2 class Solution { 3 public: 4 int hammingWeight(uint32_t n) { 5 int tot=0; 6 while(n) 7 ... 阅读全文
posted @ 2015-06-09 22:46 varcom 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1 int dp[1000000]; 2 class Solution { 3 public: 4 int rob(vector& nums) { 5 int i,n=nums.size(); 6 if(n==0) 7 return ... 阅读全文
posted @ 2015-06-09 22:12 varcom 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 bool isHappy(int n) { 4 int dig[1000],cnt,ans; 5 memset(dig,0,sizeof(dig)); 6 while(1) 7 ... 阅读全文
posted @ 2015-06-09 20:05 varcom 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 ListNode* removeElements(ListNode* head, int val) { 4 ListNode*cur,*nxt,*pre=head; 5 if(head==NULL... 阅读全文
posted @ 2015-06-09 19:27 varcom 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 1 int ary[1500005]; 2 class Solution { 3 public: 4 int countPrimes(int n) { 5 int i,j; 6 memset(ary,0,sizeof(ary)); 7 int... 阅读全文
posted @ 2015-06-09 11:20 varcom 阅读(120) 评论(0) 推荐(0) 编辑