随笔分类 -  LeetCode

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 61 下一页
摘要:Given a string S of digits, such as S = "123456579", we can split it into a Fibonacci-like sequence [123, 456, 579]. Formally, a Fibonacci-like sequen 阅读全文
posted @ 2019-02-25 23:58 Grandyang 阅读(3164) 评论(2) 推荐(1) 编辑
摘要:Given a binary search tree and a node in it, find the in-order successor of that node in the BST. The successor of a node p is the node with the small 阅读全文
posted @ 2019-02-23 23:56 Grandyang 阅读(3984) 评论(3) 推荐(0) 编辑
摘要:There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next r 阅读全文
posted @ 2019-02-21 22:33 Grandyang 阅读(2844) 评论(0) 推荐(0) 编辑
摘要:A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum. Gi 阅读全文
posted @ 2019-02-19 23:50 Grandyang 阅读(5238) 评论(0) 推荐(0) 编辑
摘要:There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t 阅读全文
posted @ 2019-02-17 23:57 Grandyang 阅读(3939) 评论(3) 推荐(2) 编辑
摘要:Alice plays the following game, loosely based on the card game "21". Alice starts with 0 points, and draws numbers while she has less than K points. D 阅读全文
posted @ 2019-02-15 23:58 Grandyang 阅读(6680) 评论(3) 推荐(1) 编辑
摘要:A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates 阅读全文
posted @ 2019-02-12 23:43 Grandyang 阅读(4440) 评论(2) 推荐(1) 编辑
摘要:Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically accord 阅读全文
posted @ 2019-02-10 23:46 Grandyang 阅读(6525) 评论(4) 推荐(0) 编辑
摘要:Two images A and B are given, represented as binary, square matrices of the same size. (A binary matrix has only 0s and 1s as values.) We translate on 阅读全文
posted @ 2019-02-07 21:44 Grandyang 阅读(5559) 评论(3) 推荐(1) 编辑
摘要:To some string S, we will perform some replacement operations that replace groups of letters with new ones (not necessarily the same size). Each repla 阅读全文
posted @ 2019-02-04 22:42 Grandyang 阅读(3872) 评论(0) 推荐(0) 编辑
摘要:Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means t 阅读全文
posted @ 2019-02-02 23:56 Grandyang 阅读(2150) 评论(1) 推荐(0) 编辑
摘要:We are given a personal information string S, which may represent either an email address or a phone number. We would like to mask this personal infor 阅读全文
posted @ 2019-01-30 23:48 Grandyang 阅读(1667) 评论(0) 推荐(0) 编辑
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g 阅读全文
posted @ 2019-01-28 22:21 Grandyang 阅读(1783) 评论(0) 推荐(0) 编辑
摘要:Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size. Each person may dislike some other peopl 阅读全文
posted @ 2019-01-24 22:08 Grandyang 阅读(4548) 评论(0) 推荐(0) 编辑
摘要:The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding one 阅读全文
posted @ 2019-01-22 23:57 Grandyang 阅读(5002) 评论(3) 推荐(1) 编辑
摘要:We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7], this means that t 阅读全文
posted @ 2019-01-20 05:58 Grandyang 阅读(4585) 评论(3) 推荐(0) 编辑
摘要:In a given integer array A, we must move every element of A to either list B or list C. (B and C initially start empty.) Return true if and only if af 阅读全文
posted @ 2019-01-17 23:56 Grandyang 阅读(4412) 评论(2) 推荐(0) 编辑
摘要:We have jobs: difficulty[i] is the difficulty of the ith job, and profit[i] is the profit of the ith job. Now we have some workers. worker[i] is the a 阅读全文
posted @ 2019-01-14 00:00 Grandyang 阅读(2388) 评论(0) 推荐(0) 编辑
摘要:Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request pers 阅读全文
posted @ 2019-01-10 23:12 Grandyang 阅读(3188) 评论(0) 推荐(0) 编辑
摘要:A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only. We would like to convert the 阅读全文
posted @ 2019-01-08 01:36 Grandyang 阅读(2355) 评论(0) 推荐(0) 编辑

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 61 下一页
Fork me on GitHub