![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
wenmiao_
这个作者很懒,什么都没留下…
展开
-
Leetcode 832. Flipping an Image
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 you from robbing each of them is that adjacent house...原创 2019-12-30 12:09:32 · 103 阅读 · 0 评论 -
LeetCode 904. Fruit Into Baskets
In a row of trees, the i-th tree produces fruit with type tree[i].You start at any tree of your choice, then repeatedly perform the following steps:Add one piece of fruit from this tree to your ba...原创 2018-09-17 19:15:22 · 332 阅读 · 0 评论 -
LeetCode 111. Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note: A leaf is a node with no childre...原创 2018-09-24 10:19:14 · 82 阅读 · 0 评论 -
LeetCode Subsets 系列
78. SubsetsGiven a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:...原创 2018-08-16 11:35:18 · 107 阅读 · 0 评论 -
LeetCode 926. Flip String to Monotone Increasing
A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), followed by some number of '1's (also possibly 0.)We are given a string S of '0's and '1's, and w...原创 2018-10-21 11:00:36 · 214 阅读 · 0 评论 -
LeetCode 927. Three Equal Parts
Given an array A of 0s and 1s, divide the array into 3 non-empty parts such that all of these parts represent the same binary value.If it is possible, return any [i, j] with i+1 < j, such that:...原创 2018-10-21 11:00:31 · 175 阅读 · 0 评论 -
LeetCode 948. Bag of Tokens
You have an initial power P, an initial score of 0 points, and a bag of tokens.Each token can be used at most once, has a value token[i], and has potentially two ways to use it.If we have at least...原创 2018-11-25 20:48:10 · 288 阅读 · 0 评论 -
LeetCode 946. Validate Stack Sequences
Given two sequences pushed and popped with distinct values, return true if and only if this could have been the result of a sequence of push and pop operations on an initially empty stack. Example...原创 2018-11-25 20:45:14 · 259 阅读 · 0 评论 -
LeetCode 945. Minimum Increment to Make Array Unique
Given an array of integers A, a move consists of choosing any A[i], and incrementing it by 1.Return the least number of moves to make every value in A unique. Example 1:Input: [1,2,2]Output:...原创 2018-11-25 20:41:27 · 227 阅读 · 0 评论 -
Leetcode 997. Find the Town Judge
In a town, there areNpeople labelled from1toN. There is a rumor that one of these people is secretly the town judge.If thetown judge exists, then:The town judge trusts nobody. Everybody (e...原创 2019-03-10 13:58:52 · 139 阅读 · 0 评论 -
LeetCode 905. Sort Array By Parity python
Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A.You may return any answer array that satisfies this conditi...原创 2018-09-17 17:22:36 · 579 阅读 · 0 评论 -
LeetCode 901. Online Stock Span
Write a class StockSpanner which collects daily price quotes for some stock, and returns the span of that stock's price for the current day.The span of the stock's price today is defined as the maxi...原创 2018-09-09 19:55:02 · 247 阅读 · 0 评论 -
LeetCode 900. RLE Iterator
Write an iterator that iterates through a run-length encoded sequence.The iterator is initialized by RLEIterator(int[] A), where A is a run-length encoding of some sequence. More specifically, for ...原创 2018-09-09 19:53:40 · 243 阅读 · 0 评论 -
LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, giveninorder = [9,3,15,20,7]postorder = [9...原创 2018-08-19 16:20:23 · 88 阅读 · 0 评论 -
LeetCode 889. Construct Binary Tree from Preorder and Postorder Traversal
Return any binary tree that matches the given preorder and postorder traversals.Values in the traversals pre and post are distinct positive integers. Example 1:Input: pre = [1,2,4,5,3,6,7], p...原创 2018-08-19 16:22:28 · 352 阅读 · 0 评论 -
Leetcode 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Input: ["flower","flow","flight"]Outp...原创 2018-07-15 19:36:49 · 157 阅读 · 0 评论 -
LeetCode 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-...原创 2018-07-16 16:30:15 · 83 阅读 · 0 评论 -
LeetCode 414. Third Maximum Number
Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2,...原创 2018-07-30 12:08:22 · 172 阅读 · 0 评论 -
LeetCode 67. Add Binary
Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"Output: "100"Exam...原创 2018-07-31 12:18:11 · 78 阅读 · 0 评论 -
LeetCode 105. Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, givenpreorder = [3,9,20,15,7]inorder = [9,3...原创 2018-08-16 16:18:24 · 76 阅读 · 0 评论 -
LeetCode 168. Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -&g...原创 2018-08-22 22:25:17 · 104 阅读 · 0 评论 -
LeetCode 289. Game of Life
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."Given a board with m by n...原创 2018-08-21 23:06:54 · 86 阅读 · 0 评论