随笔分类 -  LeetCode

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 61 下一页
摘要:On an N x N , the numbers from to are written boustrophedonically starting from the bottom left of the board, and alternating direction each row. For 阅读全文
posted @ 2019-08-12 21:16 Grandyang 阅读(4587) 评论(4) 推荐(0)
摘要:There are workers. The th worker has a and a minimum wage expectation . Now we want to hire exactly workers to form a paid group . When hiring a group 阅读全文
posted @ 2019-08-09 20:34 Grandyang 阅读(3254) 评论(0) 推荐(1)
摘要:Given an array of integers, for each integer we may choose any with ` K 这道题说是给了一个非负数的数组,和一个非负数K,说是数组中的每一个数字都可以加上 [ K, K] 范围内的任意一个数字,问新数组的最大值最小值之间的差值最小 阅读全文
posted @ 2019-08-07 22:20 Grandyang 阅读(2174) 评论(0) 推荐(0)
摘要:Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, ret 阅读全文
posted @ 2019-08-04 22:01 Grandyang 阅读(6310) 评论(4) 推荐(1)
摘要:Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return 阅读全文
posted @ 2019-07-30 22:53 Grandyang 阅读(6911) 评论(2) 推荐(0)
摘要:We are given a 2-dimensional grid. "." is an empty cell, "#" is a wall, "@" is the starting point, ("a", "b", ...) are keys, and ("A", "B", ...) are l 阅读全文
posted @ 2019-07-20 23:27 Grandyang 阅读(2931) 评论(3) 推荐(0)
摘要:Let's say a positive integer is a *superpalindrome* if it is a palindrome, and it is also the square of a palindrome. Now, given two positive integers 阅读全文
posted @ 2019-07-17 23:49 Grandyang 阅读(2304) 评论(2) 推荐(0)
摘要:A car travels from a starting position to a destination which is miles east of the starting position. Along the way, there are gas stations. Each repr 阅读全文
posted @ 2019-07-14 23:58 Grandyang 阅读(3297) 评论(0) 推荐(2)
摘要:Given an array of non negative integers, return an array consisting of all the even elements of , followed by all the odd elements of . You may return 阅读全文
posted @ 2019-07-11 23:32 Grandyang 阅读(4983) 评论(0) 推荐(0)
摘要:We run a preorder depth first search on the rootof a binary tree. At each node in this traversal, we output D dashes (where D is the depth of this nod 阅读全文
posted @ 2019-07-08 08:22 Grandyang 阅读(1827) 评论(0) 推荐(0)
摘要:A positive integer is magical if it is divisible by either A or B. Return the N th magical number. Since the answer may be very large, return it modul 阅读全文
posted @ 2019-07-07 23:49 Grandyang 阅读(2700) 评论(0) 推荐(1)
摘要:In a row of trees, the th tree produces fruit with type . You start at any tree of your choice, then repeatedly perform the following steps: 1. Add on 阅读全文
posted @ 2019-07-03 23:45 Grandyang 阅读(6222) 评论(0) 推荐(0)
摘要:There are G people in a gang, and a list of various crimes they could commit. The th crime generates a and requires gang members to participate. If a 阅读全文
posted @ 2019-06-29 22:52 Grandyang 阅读(2286) 评论(0) 推荐(0)
摘要:We are given , a length string of characters from the set . (These letters stand for "decreasing" and "increasing".) A valid permutation is a permutat 阅读全文
posted @ 2019-06-26 23:22 Grandyang 阅读(6239) 评论(3) 推荐(0)
摘要:Starting with an undirected graph (the "original graph") with nodes from to , subdivisions are made to some of the edges. The graph is given as follow 阅读全文
posted @ 2019-06-23 23:49 Grandyang 阅读(2055) 评论(1) 推荐(0)
摘要:We have a sorted set of digits D, a non-empty subset of {'1','2','3','4','5','6','7','8','9'}. (Note that '0' is not included.) Now, we write numbers 阅读全文
posted @ 2019-06-20 23:53 Grandyang 阅读(2408) 评论(0) 推荐(0)
摘要:You are given eggs, and you have access to a building with floors from to . Each egg is identical in function, and if an egg breaks, you cannot drop i 阅读全文
posted @ 2019-06-18 22:09 Grandyang 阅读(7887) 评论(3) 推荐(2)
摘要:Write a class 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' 阅读全文
posted @ 2019-06-15 23:27 Grandyang 阅读(3430) 评论(3) 推荐(0)
摘要:Given an array of integers , consider all non empty subsequences of . For any sequence S, let the width of S be the difference between the maximum and 阅读全文
posted @ 2019-06-13 23:02 Grandyang 阅读(1728) 评论(0) 推荐(0)
摘要:Write an iterator that iterates through a run length encoded sequence. The iterator is initialized by , where is a run length encoding of some sequenc 阅读全文
posted @ 2019-06-11 22:47 Grandyang 阅读(2287) 评论(0) 推荐(1)

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 61 下一页
Fork me on GitHub