随笔分类 -  LeetCode

上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 61 下一页
摘要: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 阅读(5199) 评论(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 阅读(3016) 评论(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 阅读(7068) 评论(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 阅读(7880) 评论(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 阅读(6237) 评论(1) 推荐(0)
摘要:You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (target[0], target[1]). There are several ghosts on t 阅读全文
posted @ 2018-06-11 08:00 Grandyang 阅读(3034) 评论(2) 推荐(0)
摘要:X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotate 阅读全文
posted @ 2018-06-08 11:56 Grandyang 阅读(5540) 评论(3) 推荐(0)
摘要:A sorted list A contains 1, plus some number of primes. Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fra 阅读全文
posted @ 2018-06-04 19:59 Grandyang 阅读(4796) 评论(3) 推荐(0)
摘要:There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and fights, togethe 阅读全文
posted @ 2018-05-30 11:31 Grandyang 阅读(12503) 评论(4) 推荐(0)
摘要:Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible stri 阅读全文
posted @ 2018-05-21 09:21 Grandyang 阅读(6192) 评论(2) 推荐(1)
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa 阅读全文
posted @ 2018-05-19 23:46 Grandyang 阅读(4801) 评论(1) 推荐(0)
摘要:An N x N board contains only 0s and 1s. In each move, you can swap any 2 rows with each other, or any 2 columns with each other. What is the minimum n 阅读全文
posted @ 2018-05-17 22:32 Grandyang 阅读(5205) 评论(0) 推荐(1)
摘要:In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Th 阅读全文
posted @ 2018-05-15 23:39 Grandyang 阅读(4317) 评论(1) 推荐(1)
摘要:A move consists of taking a point (x, y) and transforming it to either (x, x+y) or (x+y, y). Given a starting point (sx, sy) and a target point (tx, t 阅读全文
posted @ 2018-05-13 23:22 Grandyang 阅读(5529) 评论(3) 推荐(0)
摘要:On the first row, we write a 0. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence 阅读全文
posted @ 2018-05-11 23:55 Grandyang 阅读(5062) 评论(0) 推荐(0)
摘要:On an N x N grid, each square grid[i][j] represents the elevation at that point (i,j). Now rain starts to fall. At time t, the depth of the water ever 阅读全文
posted @ 2018-05-09 23:26 Grandyang 阅读(6077) 评论(2) 推荐(1)
摘要: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 repla 阅读全文
posted @ 2018-05-07 10:54 Grandyang 阅读(5856) 评论(4) 推荐(0)
摘要:Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all 阅读全文
posted @ 2018-05-04 23:40 Grandyang 阅读(6068) 评论(2) 推荐(0)
摘要:We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (global) inversions is the number of i < j with 0 <= i < j 阅读全文
posted @ 2018-05-02 23:07 Grandyang 阅读(3327) 评论(4) 推荐(1)
摘要:On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., stations[N-1], where N = stations.length. Now, we add K  阅读全文
posted @ 2018-04-28 23:59 Grandyang 阅读(7239) 评论(6) 推荐(1)

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