摘要: 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 阅读(777) 评论(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 阅读(1036) 评论(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 阅读(1134) 评论(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 阅读(1011) 评论(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 阅读(601) 评论(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 阅读(1397) 评论(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 阅读(665) 评论(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 阅读(392) 评论(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 阅读(609) 评论(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 阅读(307) 评论(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 阅读(1317) 评论(0) 推荐(0) 编辑
摘要: Given two numbers arr1 and arr2 in base -2, return the result of adding them together. Each number is given in array format: as an array of 0s and 1s, 阅读全文
posted @ 2021-03-28 11:57 Grandyang 阅读(509) 评论(0) 推荐(0) 编辑
Fork me on GitHub