自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [LeetCode 351] Android Unlock Patterns

Given an Android3x3key lock screen and two integersmandn, where1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock screen, which consist of minimum ofmkeys and maximum...

2019-06-13 23:39:30 355

原创 [LeetCode 281] Zigzag Iterator

Follow upZigzag Iterator: What if you are givenk1d vectors? How well can your code be extended to such cases? The "Zigzag" order is not clearly defined and is ambiguous fork > 2cases. If "Zigz...

2019-06-11 23:25:44 164

原创 [LeetCode 418] Sentence Screen Fitting

Given arows x colsscreen and a sentence represented by a list ofnon-emptywords, findhow many timesthe given sentence can be fitted on the screen.ExampleExample 1: Input: rows = 4, cols = 5...

2019-06-11 23:02:12 241

原创 [LeetCode 360] Sort Transformed Array

Given asortedarray of integers nums and integer values a, b and c. Apply a quadratic function of the formf(x)=ax^2+bx+cf(x)=ax​2​​+bx+cto each elementxxin the array.The returned array must be ...

2019-06-07 18:35:50 156

原创 [LeetCode 285] Inorder Successor in BST

Given a binary search tree (See Definition) and a node in it, find the in-order successor of that node in the BST.If the given node has no in-order successor in the tree, returnnull.ExampleExam...

2019-06-07 17:36:09 148

原创 [LeetCode 644] Maximum Average Subarray II

Given an array with positive and negative numbers, find themaximum average subarraywhich length should be greater or equal to given lengthk.ExampleExample 1:Input:[1,12,-5,-6,50,3]3Output...

2019-06-07 17:12:19 254

原创 [LeetCode 549] Binary Tree Longest Consecutive Sequence II

Description中文EnglishGiven a binary tree, find the length(number of nodes) of the longest consecutive sequence(Monotonic and adjacent node values differ by 1) path.The path could be start and end ...

2019-06-07 11:03:30 226

原创 [LeetCode 298] Binary Tree Longest Consecutive Sequence

Given a binary tree, find the length of the longest consecutive sequence path.The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connecti...

2019-06-05 23:21:53 109

原创 [LeetCode 639] Word Abbreviation

Given an array of n distinct non-empty strings, you need to generateminimalpossible abbreviations for every word following rules below.Begin with the first character and then the number of characte...

2019-06-05 23:09:59 210

原创 [LeetCode 874] Maximum Vacation Days

LintCode wants to give one of its best employees the option to travel amongNcities to collect algorithm problems. But all work and no play makes Jack a dull boy, you could take vacations in some par...

2019-06-04 23:05:02 175

原创 [LeetCode 660] Read N Characters Given Read4 II - Call multiple times

The API:int read4(char *buf)reads4characters at a time from a file.The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the f...

2019-06-03 23:31:36 196

原创 [LeetCode 903] Range Addition

Assume you have an array of lengthninitialized with all0's and are givenkupdate operations.Each operation is represented as a triplet:[startIndex, endIndex, inc]which increments each element of...

2019-06-03 22:48:48 366

原创 [LeetCode 788] The Maze II

There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rollingup,down,leftorright, but it won't stop rolling until hitting a wall. When the ball stops, it ...

2019-06-02 19:47:39 154

原创 [LeetCode 787] The Maze

There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rollingup,down,leftorright,but it won't stop rolling until hitting a wall. When the ball stops, it ...

2019-06-02 19:09:24 257

原创 [LeetCode 634] Word Squares

Given a set of wordswithout duplicates, find allword squaresyou can build from them.A sequence of words forms a valid word square if the kth row and column read the exact same string, where 0 ≤ k...

2019-06-02 17:47:50 243

原创 [LeetCode 641] Missing Ranges

Given a sorted integer array wherethe range of elements are in the inclusive range [lower, upper], return its missing ranges.ExampleExample 1Input:nums = [0, 1, 3, 50, 75], lower = 0 and uppe...

2019-06-02 15:03:02 97

原创 [LeetCode 862] Next Closest Time

Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused.You may assume the given input str...

2019-06-02 14:43:47 177

原创 [LeetCode 861] K Empty Slots

There is a garden withNslots. In each slot, there is a flower. TheNflowers will bloom one by one inNdays. In each day, there will beexactlyone flower blooming and it will be in the status of b...

2019-06-01 22:40:27 103

原创 [LeetCode 361] Bomb Enemy

Given a 2D grid, each cell is either a wall'W', an enemy'E'or empty'0'(the number zero), return the maximum enemies you can kill using one bomb.The bomb kills all the enemies in the same row and ...

2019-06-01 21:53:52 369

原创 [LeetCode 616] Add Bold Tag in String

Given a string s and a list of strings dict, you need to add a closed pair of bold tagandto wrap the substrings in s that exist in dict. If two such substrings overlap, you need to wrap them togethe...

2019-06-01 21:33:59 316

原创 [LeetCode 261] Graph Valid Tree

Givennnodes labeled from0ton - 1and a list ofundirectededges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.ExampleExample 1:Input: n...

2019-05-30 23:19:37 737

原创 [LeetCode 159] Longest Substring with At Most K Distinct Characters

Given a stringS, find the length of the longest substringTthat contains at most k distinct characters.ExampleExample 1:Input: S = "eceba" and k = 3Output: 4Explanation: T = "eceb"Exampl...

2019-05-29 23:45:34 167

原创 [LeetCode 750] Number Of Corner Rectangles

Given a grid with only 0 and 1, find the number of corner rectangles.Note that only the corners need to have the value 1. Also, all four 1s used must be distinct.ExampleExample 1:Input: [ ...

2019-05-29 23:01:59 176

原创 [LeetCode 60] Permutation Sequence

The set[1,2,3,...,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence forn= 3:"123" "132" "213" "231" "312"...

2019-05-26 20:13:03 69

原创 [LeetCode 815] Bus Routes

We have a list of bus routes. Eachroutes[i]is a bus route that the i-th busrepeats forever. For example ifroutes[0] = [1, 5, 7], this means that the firstbus (0-th indexed) travels in the sequenc...

2019-05-26 18:52:15 195

原创 [LeetCode 395] Longest Substring with At Least K Repeating Characters

Find the length of the longest substringTof a given string (consists of lowercase letters only) such that every character inTappears no less thanktimes.Example 1:Input:s = "aaabb", k = ...

2019-05-26 17:48:29 104

原创 [LeetCode 220] Contains Duplicate III

Given an array of integers, find out whether there are two distinct indicesiandjin the array such that theabsolutedifference betweennums[i]andnums[j]is at mosttand theabsolutedifference ...

2019-05-26 16:01:43 96

原创 [LeetCode 552] Student Attendance Record II

Given a positive integern, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109+ 7.A stud...

2019-05-26 15:03:37 163

原创 [LeetCode 300] Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence.Example:Input: [10,9,2,5,3,7,101,18]Output: 4 Explanation: The longest increasing subsequence is [2,3,7,1...

2019-05-26 12:27:02 128

原创 [LeetCode 732] My Calendar III

Implement aMyCalendarThreeclass to store your events. A new event canalwaysbe added.Your class will have one method,book(int start, int end). Formally, this represents a booking on the half open...

2019-05-26 11:27:30 215

原创 [LeetCode 731] My Calendar II

Implement aMyCalendarTwoclass to store your events. A new event can be added if adding the event will not cause atriplebooking.Your class will have one method,book(int start, int end). Formally...

2019-05-26 10:45:08 201

原创 [LeetCode 729] My Calendar I

Implement aMyCalendarclass to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method,book(int start, int end). Formally, t...

2019-05-25 19:39:41 234

原创 [LeetCode 809] Expressive Words

Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". In these strings like "heeellooo", we havegroupsof adjacent letters that are all t...

2019-05-25 19:18:31 156

原创 [LeetCode 593] Valid Square

Given the coordinates of four points in 2D space, return whether the four points could construct a square.The coordinate (x,y) of a point is represented by an integer array with two integers.Examp...

2019-05-25 17:50:58 89

原创 [LeetCode 524] Longest Word in Dictionary through Deleting

Given a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given string. If there are more than one possible results, retur...

2019-05-25 11:48:24 78

原创 [LeetCode 792] Number of Matching Subsequences

Given stringSand adictionary of wordswords, find the number ofwords[i]that is a subsequence ofS.Example :Input: S = "abcde"words = ["a", "bb", "acd", "ace"]Output: 3Explanation: There ...

2019-05-25 11:24:12 120

原创 [LeetCode 769] Max Chunks To Make Sorted

Given an arrayarrthat is a permutation of[0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individually sort each chunk. After concatenating them,the ...

2019-05-25 10:27:28 95

原创 [LeetCode 134] Gas Station

There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costscost[i]of gas to travel from stationito its ...

2019-05-21 23:41:37 168

原创 [LeetCode 785] Is Graph Bipartite?

Given an undirectedgraph, returntrueif and only if it is bipartite.Recall that a graph isbipartiteif we can split it's set of nodes into two independentsubsets A and B such that every edge in ...

2019-05-21 23:14:51 117

原创 [LeetCode 777] Swap Adjacent in LR String

In a string composed of'L','R', and'X'characters, like"RXXLRXRXL", a move consists of either replacing one occurrence of"XL"with"LX", or replacing one occurrence of"RX"with"XR". Given the s...

2019-05-20 23:50:13 102

空空如也

空空如也

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

TA关注的人

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