2015年4月17日
摘要: Bitwise AND of Numbers Range2015.4.17 06:30Given a range [m, n] where 0 m) { 6 n = (n & n - 1); 7 } 8 return m & n; 9 ... 阅读全文
posted @ 2015-04-17 06:32 zhuli19901106 阅读(394) 评论(0) 推荐(0) 编辑
摘要: Number of Islands2015.4.17 06:16Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and i... 阅读全文
posted @ 2015-04-17 06:22 zhuli19901106 阅读(337) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Right Side View2015.4.17 06:04Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can... 阅读全文
posted @ 2015-04-17 06:07 zhuli19901106 阅读(345) 评论(0) 推荐(0) 编辑
摘要: House Robber2015.4.17 05:52You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the ... 阅读全文
posted @ 2015-04-17 05:56 zhuli19901106 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Number of 1 Bits2015.4.17 05:48Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming wei... 阅读全文
posted @ 2015-04-17 05:50 zhuli19901106 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Reverse Bits2015.4.17 05:42Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010... 阅读全文
posted @ 2015-04-17 05:45 zhuli19901106 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Rotate Array2015.4.17 05:37Rotate 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,... 阅读全文
posted @ 2015-04-17 05:40 zhuli19901106 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Best Time to Buy and Sell Stock IV2015.4.17 05:27Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorit... 阅读全文
posted @ 2015-04-17 05:36 zhuli19901106 阅读(329) 评论(0) 推荐(0) 编辑