### LeetCode

1 已关注
98篇博文
• #### LeetCode 50. Pow(x, n)

描述 Implement pow(x, n).分析 二分法，xn = xn/2 × xn/2 × xn%2代码class Solution { public: double myPow(d...

2017-02-07 00:41
221
• #### LeetCode 342. Power of Four

描述 Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example:...

2017-02-07 00:33
200
• #### LeetCode 231. Power of Two

描述 Given an integer, write a function to determine if it is a power of two.分析 如果是power of two, 则2进...

2017-02-07 00:17
114
• #### LeetCode 75. Sort Colors

描述 Given an array with n objects colored red, white or blue, sort them so that objects of the same ...

2017-02-06 23:52
200
• #### LeetCode 387. First Unique Character in a String

描述 Given a string, find the first non-repeating character in it and return it’s index. If it doesn’...

2017-02-06 23:24
179
• #### LeetCode 41. First Missing Positive

描述 Given an unsorted integer array, find the first missing positive integer.For example, Given [1,...

2017-02-06 23:05
160
• #### LeetCode 18. 4Sum

描述 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d =...

2017-02-06 22:22
193
• #### LeetCode 16. 3Sum Closest

描述 Given an array S of n integers, find three integers in S such that the sum is closest to a given...

2017-02-06 21:05
166
• #### LeetCode 344. Reverse String

描述 Write a function that takes a string as input and returns the string reversed.Example: Given s ...

2017-02-05 23:04
189
• #### LeetCode 58. Length of Last Word

描述 Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return t...

2017-02-05 22:54
189
• #### LeetCode 67. Add Binary

描述 Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1...

2017-02-05 22:38
158
• #### LeetCode 12. Integer to Roman

描述 Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from ...

2017-02-05 22:20
194
• #### LeetCode 13. Roman to Integer

描述 Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from ...

2017-02-05 22:07
185
• #### LeetCode 125. Valid Palindrome

描述 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ig...

2017-02-05 19:28
160
• #### LeetCode 48. Rotate Image

描述 You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise...

2017-02-05 18:24
171
• #### LeetCode 60. Permutation Sequence

描述 The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of th...

2017-02-05 17:55
182
• #### LeetCode 46. Permutations

描述 Given a collection of distinct numbers, return all possible permutations.For example, [1,2,3] h...

2017-02-05 17:29
198
• #### LeetCode 31. Next Permutation

描述 Implement next permutation, which rearranges numbers into the lexicographically next greater per...

2017-02-05 16:42
511
• #### LeetCode 70. Climbing Stairs

描述You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb...

2017-02-05 12:14
262
• #### LeetCode 33. Search in Rotated Sorted Array

描述 Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i...

2017-02-03 23:48
155