2015年4月27日

Bitwise AND of Numbers Range

摘要: Bitwise AND of Numbers Range问题:Given a range [m, n] where 0 n || m>= 1; n >>= 1; moveFactor <<= 1; } return m * mo... 阅读全文

posted @ 2015-04-27 21:12 zhouzhou0615 阅读(253) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock III

摘要: Best Time to Buy and Sell Stock III问题:Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find ... 阅读全文

posted @ 2015-04-27 20:35 zhouzhou0615 阅读(130) 评论(0) 推荐(0) 编辑

First Missing Positive

摘要: First Missing Positive问题:Given an unsorted integer array, find the first missing positive integer.思路: A[A[i]] == A[i] 的经典应用我的代码:public class Solution... 阅读全文

posted @ 2015-04-27 18:48 zhouzhou0615 阅读(152) 评论(0) 推荐(0) 编辑

Permutation Sequence

摘要: Permutation Sequence问题:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,思路:假设有n个元素... 阅读全文

posted @ 2015-04-27 15:52 zhouzhou0615 阅读(151) 评论(0) 推荐(0) 编辑

Next Permutation

摘要: Next Permutation问题:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrange... 阅读全文

posted @ 2015-04-27 15:00 zhouzhou0615 阅读(121) 评论(0) 推荐(0) 编辑

Gray Code

摘要: Gray Code问题:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the ... 阅读全文

posted @ 2015-04-27 10:48 zhouzhou0615 阅读(177) 评论(0) 推荐(0) 编辑

Number of Islands

摘要: Number of Islands问题: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 ... 阅读全文

posted @ 2015-04-27 10:14 zhouzhou0615 阅读(152) 评论(0) 推荐(0) 编辑

导航