摘要: Reverse a singly linked list./** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int... 阅读全文
posted @ 2015-08-03 22:38 ~每天进步一点点~ 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-08-03 22:29 ~每天进步一点点~ 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Description:Count the number of prime numbers less than a non-negative number,n.public class Solution { public int countPrimes(int n) { //筛选... 阅读全文
posted @ 2015-08-03 22:14 ~每天进步一点点~ 阅读(86) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-08-03 22:02 ~每天进步一点点~ 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-08-03 21:54 ~每天进步一点点~ 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Given a range [m, n] where 0 m 1101 11111111 –>n 可以去掉的就是n的分割部分的1。 所以结果其实就是m和n公共头部*/ int res=0; if(m==0)return 0; ... 阅读全文
posted @ 2015-08-03 21:40 ~每天进步一点点~ 阅读(123) 评论(0) 推荐(0) 编辑
摘要: Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent ... 阅读全文
posted @ 2015-08-03 21:26 ~每天进步一点点~ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl... 阅读全文
posted @ 2015-08-03 20:56 ~每天进步一点点~ 阅读(119) 评论(0) 推荐(0) 编辑
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文
posted @ 2015-08-03 20:46 ~每天进步一点点~ 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in... 阅读全文
posted @ 2015-08-03 20:34 ~每天进步一点点~ 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ... 阅读全文
posted @ 2015-08-03 20:31 ~每天进步一点点~ 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to come... 阅读全文
posted @ 2015-08-03 19:50 ~每天进步一点点~ 阅读(108) 评论(0) 推荐(0) 编辑