随笔分类 -  LeetCode

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 61 下一页
摘要:We have a sequence of books: the i-th book has thickness books[i][0] and height books[i][1]. We want to place these books in order onto bookcase shelv 阅读全文
posted @ 2021-04-22 15:56 Grandyang 阅读(885) 评论(2) 推荐(0) 编辑
摘要:In an infinite binary tree where every node has two children, the nodes are labelled in row order. In the odd numbered rows (ie., the first, third, fi 阅读全文
posted @ 2021-04-15 15:55 Grandyang 阅读(454) 评论(0) 推荐(0) 编辑
摘要:We distribute some number of candies, to a row of n = num_people people in the following way: We then give 1 candy to the first person, 2 candies to t 阅读全文
posted @ 2021-04-09 16:24 Grandyang 阅读(543) 评论(0) 推荐(0) 编辑
摘要:Under a grammar given below, strings can represent a set of lowercase words. Let's use R(expr) to denote the set of words the expression represents. G 阅读全文
posted @ 2021-04-07 14:32 Grandyang 阅读(880) 评论(0) 推荐(0) 编辑
摘要:(This problem is an interactive problem.) You may recall that an array A is a mountain array if and only if: A.length >= 3 There exists some i with 0 阅读全文
posted @ 2021-04-04 16:10 Grandyang 阅读(751) 评论(0) 推荐(0) 编辑
摘要:You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot turn around an 阅读全文
posted @ 2021-04-02 13:04 Grandyang 阅读(1089) 评论(1) 推荐(0) 编辑
摘要:You are given a large sample of integers in the range [0, 255]. Since the sample is so large, it is represented by an array count where count[k] is th 阅读全文
posted @ 2021-04-01 15:33 Grandyang 阅读(504) 评论(0) 推荐(0) 编辑
摘要:Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If multiple answers exist, you may return any 阅读全文
posted @ 2021-03-30 15:44 Grandyang 阅读(992) 评论(0) 推荐(0) 编辑
摘要:Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If there is no clear path, return -1. A clear path in a 阅读全文
posted @ 2021-03-29 03:52 Grandyang 阅读(1965) 评论(0) 推荐(0) 编辑
摘要:We have a set of items: the i-th item has value values[i] and label labels[i]. Then, we choose a subset S of these items, such that: |S| <= num_wanted 阅读全文
posted @ 2021-03-28 14:59 Grandyang 阅读(767) 评论(0) 推荐(0) 编辑
摘要:Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond 阅读全文
posted @ 2021-03-28 12:30 Grandyang 阅读(1009) 评论(0) 推荐(0) 编辑
摘要:We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9, 8, 6 respectively. When 2, 3, 阅读全文
posted @ 2021-03-28 12:24 Grandyang 阅读(1113) 评论(0) 推荐(1) 编辑
摘要:On a campus represented as a 2D grid, there are N workers and M bikes, with N <= M. Each worker and bike is a 2D coordinate on this grid. Our goal is 阅读全文
posted @ 2021-03-28 12:20 Grandyang 阅读(968) 评论(2) 推荐(0) 编辑
摘要:Given a number N, return true if and only if it is a confusing number, which satisfies the following condition: We can rotate digits by 180 degrees to 阅读全文
posted @ 2021-03-28 12:19 Grandyang 阅读(576) 评论(0) 推荐(0) 编辑
摘要:From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions). Given two strings source and  阅读全文
posted @ 2021-03-28 12:18 Grandyang 阅读(1338) 评论(0) 推荐(0) 编辑
摘要:Return the lexicographically smallest subsequence of s that contains all the distinct characters of s exactly once. Note: This question is the same as 阅读全文
posted @ 2021-03-28 12:07 Grandyang 阅读(645) 评论(0) 推荐(0) 编辑
摘要:Given the root of a binary tree, consider all root to leaf paths: paths from the root to any leaf. (A leaf is a node with no children.) A node is insu 阅读全文
posted @ 2021-03-28 12:05 Grandyang 阅读(372) 评论(0) 推荐(0) 编辑
摘要:You have n tiles, where each tile has one letter tiles[i] printed on it. Return the number of possible non-empty sequences of letters you can make usi 阅读全文
posted @ 2021-03-28 12:04 Grandyang 阅读(594) 评论(0) 推荐(0) 编辑
摘要:Given words first and second, consider occurrences in some text of the form "first second third", where second comes immediately after first, and thir 阅读全文
posted @ 2021-03-28 12:01 Grandyang 阅读(294) 评论(0) 推荐(0) 编辑
摘要:Given a matrix and a target, return the number of non-empty submatrices that sum to target. A submatrix x1, y1, x2, y2 is the set of all cells matrix[ 阅读全文
posted @ 2021-03-28 11:59 Grandyang 阅读(1277) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 61 下一页
Fork me on GitHub