- 博客(924)
- 资源 (1)
- 收藏
- 关注
原创 1269. Number of Ways to Stay in the Same Place After Some Steps
You have a pointer at index0in an array of sizearrLen. At each step, you can move 1 position to the left, 1 position to the rightin the array or stay in the same place (The pointer should not be ...
2020-02-01 10:50:43
388
原创 1268. Search Suggestions System
Given an array of stringsproductsand a stringsearchWord. We want to design a system that suggests at most three product names fromproductsafter each character ofsearchWordis typed. Suggested pr...
2020-02-01 10:49:24
338
原创 1278. Palindrome Partitioning III
You are given a stringscontaining lowercase letters and an integerk. You need to :First, change some characters ofsto other lowercase English letters. Then dividesintoknon-empty disjoint s...
2020-02-01 10:07:22
163
1
原创 1277. Count Square Submatrices with All Ones
Given am * nmatrix of ones and zeros, return how manysquaresubmatrices have all ones.Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation: There are ...
2020-02-01 10:06:37
290
原创 1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix
Given am x nbinary matrixmat. In one step, you can choose one cell and flip it and all the four neighbours of itif they exist (Flip is changing 1 to 0 and 0 to 1). A pair of cells are called neigh...
2020-01-31 18:36:07
244
原创 1283. Find the Smallest Divisor Given a Threshold
Given an array of integersnumsand an integerthreshold, we will choose a positive integer divisor anddivideall the array by it and sum the result of the division. Find thesmallestdivisor such th...
2020-01-31 18:35:20
490
原创 1289. Minimum Falling Path Sum II
Given a square gridof integersarr, afalling path with non-zero shiftsis a choice ofexactly one element from each row ofarr, such that no two elements chosen in adjacent rows are inthe same colu...
2020-01-31 13:56:38
205
原创 1286. Iterator for Combination
Design an Iterator class, which has:A constructor that takes a stringcharactersofsorted distinctlowercase English letters and a numbercombinationLengthas arguments. A functionnext()that ret...
2020-01-31 13:55:40
398
原创 1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold
Given am x nmatrixmatand an integerthreshold. Return the maximum side-length of a square with a sum less than or equal tothresholdor return0if there is no such square.Example 1:Inpu...
2020-01-31 11:53:36
302
原创 1291. Sequential Digits
Aninteger hassequential digitsif and only if each digit in the number is one more than the previous digit.Return asortedlist of all the integersin the range[low, high]inclusive that have seq...
2020-01-31 11:52:40
269
原创 1298. Maximum Candies You Can Get from Boxes
Givennboxes, each box is given in the format[status, candies, keys, containedBoxes]where:status[i]: an integer which is1ifbox[i]is open and0ifbox[i]is closed. candies[i]:an integer rep...
2020-01-31 11:14:40
228
原创 1335. Minimum Difficulty of a Job Schedule
You want to schedule a list of jobs inddays. Jobs are dependent (i.e To work on thei-thjob, you have to finish all the jobsjwhere0 <= j < i).You have to finishat leastone task every d...
2020-01-30 23:07:14
284
原创 1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance
There arencities numbered from0ton-1. Given the arrayedgeswhereedges[i] = [fromi, toi, weighti]represents a bidirectional and weighted edge between citiesfromiandtoi, and given the integer...
2020-01-30 23:05:58
378
原创 1320. Minimum Distance to Type a Word Using Two Fingers
You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for example, the letterAis located at coordinate(0,0), the letterBi...
2020-01-30 23:04:00
318
原创 1319. Number of Operations to Make Network Connected
There arencomputers numbered from0ton-1connected byethernet cablesconnectionsforming a network whereconnections[i] = [a, b]represents a connection between computersaandb. Any computerca...
2020-01-30 23:00:44
370
原创 1312. Minimum Insertion Steps to Make a String Palindrome
Given a strings. In one step you can insert any character at any index of the string.Returnthe minimum number of stepsto makespalindrome.APalindrome Stringis one that reads the same backwar...
2020-01-30 22:55:57
258
原创 1310. XOR Queries of a Subarray
Given the arrayarrof positive integers and the arrayquerieswherequeries[i] = [Li,Ri],for each queryicompute theXORof elements fromLitoRi(that is,arr[Li]xorarr[Li+1]xor...xorarr[R...
2020-01-30 22:41:57
243
原创 1307. Verbal Arithmetic Puzzle
Given an equation, represented bywordson left side and theresulton right side.You need to check if the equation is solvableunder the following rules:Each character is decoded as one digit (0 ...
2020-01-30 22:37:12
470
原创 1306. Jump Game III
Given an array of non-negative integersarr, you are initially positioned atstartindex of the array. When you are at indexi, you can jumptoi + arr[i]ori - arr[i], check if you can reach toany...
2020-01-30 22:08:56
254
原创 1301. Number of Paths with Max Score
You are given a squareboardof characters. You can move on the board starting at the bottom right square marked with the character'S'.You needto reach the top left square marked with the characte...
2020-01-30 22:04:45
253
原创 1300. Sum of Mutated Array Closest to Target
Given an integer arrayarrand a target valuetarget, returnthe integervaluesuch that when we change all the integerslarger thanvaluein the given array to be equal tovalue,the sum of the array...
2020-01-30 22:02:26
436
原创 1326. Minimum Number of Taps to Open to Water a Garden
There is a one-dimensional garden on the x-axis. The garden starts at the point0and ends at the pointn. (i.e The length of the garden isn).There aren + 1taps locatedat points[0, 1, ..., n]i...
2020-01-25 21:18:01
465
原创 1325. Delete Leaves With a Given Value
Given a binary treerootand an integertarget, delete all theleaf nodeswith valuetarget.Notethat once you delete a leaf node with valuetarget,if it's parent node becomes a leaf node and has t...
2020-01-25 21:15:29
246
原创 1324. Print Words Vertically
Given a strings.Returnall the words vertically in the same order in which they appear ins.Words are returned as a list of strings, complete withspaces when is necessary. (Trailing spaces are not...
2020-01-25 21:07:48
379
原创 1250. Check If It Is a Good Array
Given an arraynumsofpositive integers. Your task is to select some subset ofnums, multiply each element by an integer and add all these numbers.The array is said to begoodif you can obtain a su...
2019-11-04 22:18:00
212
原创 1249. Minimum Remove to Make Valid Parentheses
Given a stringsof'(',')'and lowercase English characters.Your task is to remove the minimum number of parentheses ('('or')',in any positions ) so that the resultingparentheses stringis ...
2019-11-04 22:17:08
227
原创 1248. Count Number of Nice Subarrays
Given an array of integersnumsand an integerk. Asubarrayis calledniceif there arekodd numbers on it.Return the number ofnicesub-arrays.Example 1:Input: nums = [1,1,2,1,1], k = 3O...
2019-11-04 22:15:56
388
原创 1247. Minimum Swaps to Make Strings Equal
You are given two stringss1ands2of equal lengthconsisting of letters"x"and"y"only. Your task is tomake these two strings equal to each other. You can swap any two characters that belong tod...
2019-11-04 22:14:29
383
原创 1240. Tiling a Rectangle with the Fewest Squares
Given a rectangle of sizenxm, find the minimum number of integer-sided squares that tile the rectangle.Example 1:Input: n = 2, m = 3Output: 3Explanation: 3 squares are necessary to cove...
2019-11-02 22:32:31
347
原创 1238. Circular Permutation in Binary Representation
Given 2 integersnandstart. Your task is returnanypermutationpof(0,1,2.....,2^n -1)such that :p[0] = start p[i]andp[i+1]differ by only one bit in their binary representation. p[0]andp...
2019-11-02 22:27:11
323
原创 1235. Maximum Profit in Job Scheduling
We havenjobs, where every jobis scheduled to be done fromstartTime[i]toendTime[i], obtaining a profitofprofit[i].You're given thestartTime,endTimeandprofitarrays,you need to output th...
2019-10-20 14:33:05
315
原创 1234. Replace the Substring for Balanced String
You are given a string containing only 4kinds of characters'Q','W', 'E'and'R'.A string is said to bebalancedif each of its characters appearsn/4times wherenis the length of the string.R...
2019-10-20 14:29:30
765
原创 1233. Remove Sub-Folders from the Filesystem
Given a list of folders, remove all sub-folders in those folders and return inany orderthe folders after removing.If afolder[i]is located withinanotherfolder[j], it is called asub-folderof i...
2019-10-20 14:27:10
513
原创 1224. Maximum Equal Frequency
Given an arraynumsof positive integers, return the longest possible length of an array prefix ofnums, such that it is possible to removeexactly oneelement from this prefix so that every number th...
2019-10-19 19:50:00
462
原创 1223. Dice Roll Simulation
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)consecutivetim...
2019-10-19 19:47:53
424
原创 1220. Count Vowels Permutation
Given an integern, your task is to count how many strings of lengthncan be formed under the following rules:Each character is a lower case vowel('a','e','i','o','u') Each vowel'a'may only...
2019-10-07 16:14:36
241
原创 1219. Path with Maximum Gold
In a gold minegridof sizem * n,each cell in this mine has an integer representing the amount of goldin that cell,0if it is empty.Return the maximum amount of gold youcan collect under the...
2019-10-07 16:13:40
349
原创 1218. Longest Arithmetic Subsequence of Given Difference
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 the subs...
2019-10-07 16:13:10
338
原创 1210. Minimum Moves to Reach Target with Rotations
In ann*ngrid, there is a snake that spans 2 cells and starts moving from the top left corner at(0, 0)and(0, 1). The grid has empty cells represented by zeros and blocked cells represented by ones...
2019-10-07 16:12:24
350
原创 1208. Get Equal Substrings Within Budget
You are given two stringssandtof the same length. You want to changestot. Changing thei-th character ofstoi-th character oftcosts|s[i] - t[i]|that is, the absolute difference between th...
2019-10-07 16:11:36
222
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人