摘要: class Solution {public: void rotate(int nums[], int n, int k) { k%=n; reverse(nums,0,n-k-1); reverse(nums,n-k,n-1); rev... 阅读全文
posted @ 2015-04-30 21:49 ~每天进步一点点~ 阅读(90) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: int hammingWeight(uint32_t n) { int result=0; while(n){ n=n&(n-1); result++; ... 阅读全文
posted @ 2015-04-30 21:48 ~每天进步一点点~ 阅读(100) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int rob(int[] nums) { int result=0; int rob=0; int unrob=0; for(int i=0;ib?a:b; }} 阅读全文
posted @ 2015-04-30 21:47 ~每天进步一点点~ 阅读(144) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean isHappy(int n) { int sum=0; if(n==1||n==7) return true; else if(n>1&&n0){ ... 阅读全文
posted @ 2015-04-30 21:46 ~每天进步一点点~ 阅读(102) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */public... 阅读全文
posted @ 2015-04-30 21:45 ~每天进步一点点~ 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Description:Count the number of prime numbers less than a non-negative number,npublic class Solution { public int countPrimes(int n) { if(n(... 阅读全文
posted @ 2015-04-30 21:44 ~每天进步一点点~ 阅读(167) 评论(0) 推荐(0) 编辑