自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(243)
  • 收藏
  • 关注

原创 946 Validate Stack Sequences

1 题目Given two sequencespushedandpoppedwith distinct values,returntrueif and only if this could have been the result of a sequence of push and pop operations on an initially empty stack.Example 1:Input: pushed = [1,2,3,4,5], popped = [4,5,3,2,...

2020-07-14 12:10:09 166

原创 41 First Missing Positive

Given an unsorted integer array, find the smallest missingpositive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Output:...

2020-01-06 11:03:15 138

原创 742 Closest Leaf in a Binary Tree

1 题目Given a binary treewhere every node has a unique value, and a target keyk, find the value of the nearest leaf node to targetkin the tree.Here,nearestto a leaf means the least number of e...

2020-01-06 10:44:09 154

原创 314 Binary Tree Vertical Order Traversal

1 题目Given a binary tree, return thevertical ordertraversal of its nodes' values. (ie, from top to bottom, column by column).If two nodes are in the same row and column, the order should be from...

2020-01-06 06:52:23 146

原创 198 House Robber

1 题目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...

2019-12-24 06:52:31 75

原创 1218 Longest Arithmetic Subsequence of Given Difference

1 题目Given an integer arrayarrand an integerdifference, return the length of the longest subsequence inarrwhich is an arithmetic sequence such that the difference between adjacent elements in th...

2019-12-24 06:21:58 117

原创 1137 N-th Tribonacci Number

1 题目The Tribonacci sequence Tnis defined as follows:T0= 0, T1= 1, T2= 1, and Tn+3= Tn+ Tn+1+ Tn+2for n >= 0.Givenn, return the value of Tn.2 尝试解2.1 分析求斐波那契数列的第n项,其中F(0) = 0, F...

2019-12-24 05:54:11 116

原创 1223 Dice Roll Simulation

1 题目A die simulator generates a random number from 1 to 6 for each roll.You introduced a constraint to the generator such that it cannot roll the numberimore thanrollMax[i](1-indexed)consecuti...

2019-12-24 05:24:18 307

原创 1102 Path With Maximum Minimum Value

1 题目Given amatrix of integersAwithRrows andCcolumns, findthemaximumscoreof a path starting at[0,0]and ending at[R-1,C-1].Thescoreof a path is theminimumvalue in that path. For e...

2019-12-20 14:06:51 188

原创 124 Binary Tree Maximum Path Sum

1 题目Given anon-emptybinary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child con...

2019-12-20 08:02:53 85

原创 239 Sliding Window Maximum

1 题目Given an arraynums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding wi...

2019-12-20 06:40:09 74

原创 1155 Number of Dice Rolls With Target Sum

1 题目You haveddice, and each die hasffaces numbered1, 2, ..., f.Return the number of possible ways (out offdtotal ways)modulo10^9 + 7to roll the dice so the sum of the face up numbers equ...

2019-12-18 10:47:23 181

原创 843 Guess the Word

1 题目This problem is aninteractive problemnew to the LeetCode platform.We are given a word list of unique words, each word is 6 letters long, and one word in this list is chosen assecret.You m...

2019-12-15 06:09:44 135

原创 295 Find Median from Data Stream

1 题目Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.For example,[2,3,4], the m...

2019-12-05 12:12:19 80

原创 348 Design Tic-Tac-Toe

1 题目Design a Tic-tac-toe game that is played between two players on anxngrid.You may assume the following rules:A move is guaranteed to be valid and is placed on an empty block. Once a winn...

2019-12-05 10:55:19 144

原创 759 Employee Free Time

1 题目We are given a listscheduleof employees, which represents the working time for each employee.Each employee has a list of non-overlappingIntervals, and these intervals are in sorted order....

2019-12-05 10:19:37 105

原创 1099 Two Sum Less Than K

1 题目Given an arrayAof integers andintegerK, return the maximumSsuch that there existsi < jwithA[i] + A[j] = SandS < K. If noi, jexist satisfying this equation, return -1.Example...

2019-12-05 08:15:50 122

原创 253 Meeting Rooms II

1 题目Given an array of meeting time intervals consisting of start and end times[[s1,e1],[s2,e2],...](si< ei), find the minimum number of conference rooms required.Example 1:Input: [[0, 30]...

2019-12-05 07:06:08 65

原创 269 Alien Dictionary

1题目There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list ofnon-emptywords from the dictionary, wherewords are sorte...

2019-12-04 12:39:07 179

原创 146 LRU Cache

1 题目Design and implement a data structure forLeast Recently Used (LRU) cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key...

2019-12-03 09:45:09 86

原创 23 Merge k Sorted Lists

1 题目Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3-...

2019-12-01 15:06:16 72

原创 472 Concatenated Words

1 题目Given a list of words (without duplicates), please write a program that returns all concatenated words in the given list of words.A concatenated word is defined as a string that is comprised e...

2019-12-01 13:00:20 79

原创 957 Prison Cells After N Days

1 题目There are 8 prison cells in a row, and each cell is either occupied or vacant.Each day, whether the cell is occupied or vacant changes according to the following rules:If a cell has two adja...

2019-12-01 07:40:28 121

原创 1167 Minimum Cost to Connect Sticks

1 题目You have somestickswithpositive integer lengths.You can connect any two sticks of lengthsXandYinto one stickby paying a cost ofX + Y. You perform this action until there is one stick...

2019-12-01 05:31:19 191

原创 1104 Path In Zigzag Labelled Binary Tree

1 题目In an infinite binary tree where every node has two children, the nodes are labelled in row order.In the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, w...

2019-11-26 14:33:59 95

原创 1143 Longest Common Subsequence

1 题目Given two stringstext1andtext2, return the length of their longest common subsequence.Asubsequenceof a string is a new string generated from the original string with some characters(can b...

2019-11-26 13:54:20 100

原创 692 Top K Frequent Words

1 题目Given a non-empty list of words, return thekmost frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same frequency, then the word with ...

2019-11-26 12:54:55 60

原创 980 Unique Paths III

1 题目On a 2-dimensionalgrid, there are 4 types of squares:1represents the starting square. There is exactly one starting square. 2represents the ending square. There is exactly one ending squ...

2019-11-24 14:54:06 78

原创 42 Trapping Rain Water

1 题目Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented b...

2019-11-24 13:30:30 60

原创 572 Subtree of Another Tree

1 题目Given two non-empty binary treessandt, check whether treethas exactly the same structure and node values with a subtree ofs. A subtree ofsis a tree consists of a node insand all of thi...

2019-11-24 10:17:54 87

原创 937 Reorder Data in Log Files

1 题目You have an array oflogs. Each log is a space delimited string of words.For each log, the first word in each log is an alphanumericidentifier. Then, either:Each word after the identifier...

2019-11-21 10:43:46 239

原创 409 Longest Palindrome

1 题目Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case sensitive, for example"Aa"is not...

2019-11-21 03:27:44 77

原创 1153 String Transforms Into Another String

1 题目Given two stringsstr1andstr2of the same length, determine whether you can transformstr1intostr2by doingzero or moreconversions.In one conversion you can convertalloccurrences of on...

2019-10-31 14:17:52 161

原创 1 Two Sum

1 题目Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use the...

2019-10-02 04:46:06 61

原创 45 Jump Game II

1 题目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.Your goal...

2019-10-01 08:52:53 60

原创 1161 Maximum Level Sum of a Binary Tree

1 题目Given therootof a binary tree, the level of its root is1,the level of its children is2,and so on.Return thesmallestlevelXsuch that the sum of all the values of nodes at levelXisma...

2019-09-27 11:33:04 136

原创 994 Rotting Oranges

1 题目In a given grid, each cell can have one of threevalues:the value0representing an empty cell; the value1representing a fresh orange; the value2representing a rotten orange.Every minut...

2019-09-27 07:23:52 141

原创 1200 Minimum Absolute Difference

1 题目Given anarrayofdistinctintegersarr, find all pairs of elements with the minimum absolute difference of any two elements.Return a list of pairs in ascending order(with respect to pairs), ...

2019-09-24 10:05:49 168

原创 861 Score After Flipping Matrix

1 题目We have a two dimensional matrixAwhere each value is0or1.A move consists of choosing any row or column, and toggling each value in that row or column: changing all0s to1s, and all1s to...

2019-08-19 16:48:06 80

原创 763 Partition Labels

1 题目A stringSof lowercase letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers represent...

2019-08-19 11:49:31 124

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除