随笔分类 -  LeetCode

上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 61 下一页
摘要: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 阅读(2907) 评论(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 阅读(5429) 评论(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 阅读(4692) 评论(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 阅读(12139) 评论(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 阅读(6110) 评论(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 阅读(4730) 评论(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 阅读(5072) 评论(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 阅读(4218) 评论(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 阅读(5442) 评论(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 阅读(4981) 评论(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 阅读(5819) 评论(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 阅读(5739) 评论(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 阅读(5918) 评论(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 阅读(3286) 评论(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 阅读(7071) 评论(6) 推荐(1) 编辑
摘要:On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally 阅读全文
posted @ 2018-04-26 23:31 Grandyang 阅读(7807) 评论(2) 推荐(0) 编辑
摘要:Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1] 阅读全文
posted @ 2018-04-24 23:22 Grandyang 阅读(5705) 评论(3) 推荐(0) 编辑
摘要:You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in Sis a type of stone 阅读全文
posted @ 2018-04-22 23:37 Grandyang 阅读(4574) 评论(0) 推荐(0) 编辑
摘要:Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or 阅读全文
posted @ 2018-04-18 11:58 Grandyang 阅读(26251) 评论(10) 推荐(1) 编辑
摘要:This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be 阅读全文
posted @ 2018-04-15 23:51 Grandyang 阅读(7209) 评论(2) 推荐(1) 编辑

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