- 博客(17)
- 收藏
- 关注
原创 240. Search a 2D Matrix II
Description: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integ...
2018-12-24 11:41:37
138
1
原创 63. Unique Paths II
Description: Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respectively in...
2018-12-24 11:11:29
75
原创 55. Jump Game
Description: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Dete...
2018-12-11 23:01:09
97
原创 101. Symmetric Tree
1.Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \ 3 4 4 3 But the f...
2018-12-08 07:24:11
90
原创 62. Unique Paths
Description: A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to ...
2018-12-02 13:43:47
63
原创 121. Best Time to Buy and Sell Stock
Description: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of t...
2018-11-24 20:17:24
66
原创 9.Palindrome Number
1.Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanati...
2018-11-14 18:20:46
122
原创 324. Wiggle Sort II
Description Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]… Example: (1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. ...
2018-11-08 16:49:06
74
原创 28.Implement strStr()
1.Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: haystack = “hello”, needle = “ll” Output: 2 Example 2: Input: haystack = “a...
2018-11-03 22:48:37
61
原创 455. Assign Cookies
Description: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum ...
2018-10-27 15:18:36
78
原创 70.Climbing Stairs
题目 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positiv...
2018-10-15 10:01:38
74
原创 513.Find Bottom Left Tree Value(DFS)
题目 Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Outpu...
2018-10-14 21:21:16
140
原创 35. Search Insert Position
题目 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array....
2018-10-07 09:09:16
68
原创 38.Count and Say
The count-and-say sequence is the sequence of integers with the first five terms as following: 1 11 21 1211 111221 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21...
2018-09-30 15:26:01
73
原创 406. Queue Reconstruction by Height
Description: Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in f...
2018-09-23 14:22:12
116
原创 169. Majority Element(采用分治算法)
题目 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element ...
2018-09-15 23:52:15
333
原创 [LeetCode] Reverse Integer
1.题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Here are some good questions to ask before coding. Bonus points for you if you have already thought ...
2018-09-09 00:15:23
80
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人