![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
凌凌岛
这个作者很懒,什么都没留下…
展开
-
LeetCode-112:Path Sum(路径总和)
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Note: A leaf is a node with no children.Example:Given the below binary tree and sum = 22, 5 /原创 2020-07-08 00:17:06 · 154 阅读 · 0 评论 -
LeetCode-739:Daily Temperatures(每日温度)
Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for which this is possible, put 0 instead.For example, given the原创 2020-06-11 12:54:34 · 173 阅读 · 0 评论 -
LeetCode-1431:Kids With the Greatest Number of Candies(拥有最多糖果的孩子)
Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the ith kid has.For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of原创 2020-06-01 13:55:48 · 317 阅读 · 0 评论 -
LeetCode-101:Symmetric Tree(对称二叉树)
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 3But the following [1,2,2,null,3,null,3] is not: 1 / \原创 2020-05-31 11:35:05 · 146 阅读 · 0 评论 -
LeetCode-84:Largest Rectangle in Histogram(柱状图中最大的矩形)
Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Example:Input: [2,1,5,6,2,3]Output: 10思路此题可理解为,找出每个小矩形所能扩展的最大矩形的面积暴力解法注意到每个小矩形能扩展的最大矩形的高原创 2020-05-30 15:42:20 · 193 阅读 · 1 评论 -
LeetCode-198: House Robber(打家劫舍)
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 houses have security system connected and it will automatical原创 2020-05-29 13:53:38 · 195 阅读 · 0 评论 -
LeetCode-394:Decode String(字符串解码)
Given an encoded string, return its decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaranteed to be a positive integer.You may assume that the原创 2020-05-28 23:09:19 · 210 阅读 · 0 评论 -
LeetCode105: 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,15,20,7]Return the following binary tree: 3 / \原创 2020-05-26 18:17:09 · 229 阅读 · 0 评论 -
LeetCode-287: Find the Duplicate Number(寻找重复数字——弗洛伊德循环寻找算法)
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.Example 1:Input: [1,3,4,2,2]Outp原创 2020-05-26 16:09:55 · 366 阅读 · 0 评论 -
LeetCode-76: Minimum Window Substring(最小覆盖子串)
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).Example:Input: S = "ADOBECODEBANC", T = "ABC"Output: "BANC"Note:If there is no such window in S that covers all characters in原创 2020-05-24 13:28:15 · 223 阅读 · 0 评论 -
LeetCode001-Two Sum(两数之和)
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2, 7, 11, 15], targ原创 2020-05-21 15:44:46 · 206 阅读 · 0 评论