随笔分类 -  LeetCode

上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 61 下一页
摘要:We are given non-negative integers nums[i] which are written on a chalkboard. Alice and Bob take turns erasing exactly one number from the chalkboard, 阅读全文
posted @ 2018-08-08 21:58 Grandyang 阅读(2277) 评论(3) 推荐(0) 编辑
摘要:Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". Here, we have groups, of adjacent letters 阅读全文
posted @ 2018-08-05 20:03 Grandyang 阅读(4712) 评论(0) 推荐(1) 编辑
摘要:There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations: Serve 100 ml of soup 阅读全文
posted @ 2018-08-02 12:21 Grandyang 阅读(2950) 评论(0) 推荐(0) 编辑
摘要:In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any n 阅读全文
posted @ 2018-07-28 21:21 Grandyang 阅读(7171) 评论(0) 推荐(0) 编辑
摘要:We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, 阅读全文
posted @ 2018-07-24 21:36 Grandyang 阅读(4828) 评论(3) 推荐(0) 编辑
摘要:We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would c 阅读全文
posted @ 2018-07-21 23:51 Grandyang 阅读(3307) 评论(0) 推荐(0) 编辑
摘要:International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" map 阅读全文
posted @ 2018-07-19 23:04 Grandyang 阅读(3644) 评论(2) 推荐(0) 编辑
摘要:We start at some node in a directed graph, and every turn, we walk along a directed edge of the graph. If we reach a terminal node (that is, it has no 阅读全文
posted @ 2018-07-16 20:36 Grandyang 阅读(4947) 评论(5) 推荐(0) 编辑
摘要:We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the s 阅读全文
posted @ 2018-07-14 23:56 Grandyang 阅读(5983) 评论(1) 推荐(0) 编辑
摘要:In the following, every capital letter represents some hexadecimal digit from 0 to f. The red-green-blue color "#AABBCC" can be written as "#ABC" in s 阅读全文
posted @ 2018-07-11 20:46 Grandyang 阅读(4837) 评论(0) 推荐(0) 编辑
摘要:We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup 阅读全文
posted @ 2018-07-09 22:44 Grandyang 阅读(3861) 评论(0) 推荐(0) 编辑
摘要:Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1], A{K+2], ... A[A.length - 1], A[0], A[1], ..., A 阅读全文
posted @ 2018-07-06 12:13 Grandyang 阅读(3356) 评论(1) 推荐(1) 编辑
摘要:Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order. The graph is given as follo 阅读全文
posted @ 2018-07-04 10:45 Grandyang 阅读(4689) 评论(0) 推荐(0) 编辑
摘要:We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, 阅读全文
posted @ 2018-07-01 22:13 Grandyang 阅读(5037) 评论(2) 推荐(0) 编辑
摘要:We are given an array A of positive integers, and two positive integers L and R (L <= R). Return the number of (contiguous, non-empty) subarrays such 阅读全文
posted @ 2018-06-28 11:47 Grandyang 阅读(3505) 评论(2) 推荐(1) 编辑
摘要:A Tic-Tac-Toe board is given as a string array board. Return True if and only if it is possible to reach this board position during the course of a va 阅读全文
posted @ 2018-06-25 10:21 Grandyang 阅读(5139) 评论(1) 推荐(1) 编辑
摘要:Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * ... * x, and by convention, 0! = 1.) For example, f(3) = 0 because 3! 阅读全文
posted @ 2018-06-22 16:15 Grandyang 阅读(2943) 评论(7) 推荐(1) 编辑
摘要:Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s. A subsequence of a string is a new string ge 阅读全文
posted @ 2018-06-19 21:53 Grandyang 阅读(6944) 评论(0) 推荐(0) 编辑
摘要:S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to per 阅读全文
posted @ 2018-06-16 11:13 Grandyang 阅读(7740) 评论(0) 推荐(0) 编辑
摘要:You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the number of ways to t 阅读全文
posted @ 2018-06-13 19:58 Grandyang 阅读(5785) 评论(1) 推荐(0) 编辑

上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 61 下一页
Fork me on GitHub