上一页 1 2 3 4 5 6 7 8 9 10 ··· 44 下一页
摘要: 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 阅读(649) 评论(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 阅读(595) 评论(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 阅读(295) 评论(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 阅读(1289) 评论(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 阅读(497) 评论(0) 推荐(0) 编辑
摘要: You are given an binary matrix . You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the 阅读全文
posted @ 2021-03-16 15:52 Grandyang 阅读(424) 评论(0) 推荐(0) 编辑
摘要: For two strings and , we say " divides " if and only if ( concatenated with itself 1 or more times) Given two strings str1 and str2, return the larges 阅读全文
posted @ 2021-03-15 14:08 Grandyang 阅读(1614) 评论(0) 推荐(0) 编辑
摘要: In a warehouse, there is a row of barcodes, where the barcode is . Rearrange the barcodes so that no two adjacent barcodes are equal. You may return a 阅读全文
posted @ 2021-03-13 16:24 Grandyang 阅读(414) 评论(0) 推荐(0) 编辑
摘要: Given an array of positive integers (not necessarily distinct), return the lexicographically largest permutation that is smaller than , that can be ma 阅读全文
posted @ 2021-03-12 14:13 Grandyang 阅读(551) 评论(0) 推荐(0) 编辑
摘要: Today, the bookstore owner has a store open for minutes. Every minute, some number of customers ( ) enter the store, and all those customers leave aft 阅读全文
posted @ 2021-03-09 17:19 Grandyang 阅读(641) 评论(1) 推荐(0) 编辑
摘要: Given a string s, consider all duplicated substrings: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return any 阅读全文
posted @ 2021-03-08 07:13 Grandyang 阅读(1963) 评论(1) 推荐(1) 编辑
摘要: Students are asked to stand in non decreasing order of heights for an annual photo. Return the minimum number of students that must move in order for 阅读全文
posted @ 2021-03-05 13:34 Grandyang 阅读(498) 评论(0) 推荐(0) 编辑
摘要: You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choo 阅读全文
posted @ 2021-03-04 15:15 Grandyang 阅读(1731) 评论(1) 推荐(1) 编辑
摘要: Given a list of words, each word consists of English lowercase letters. Let's say is a predecessor of if and only if we can add exactly one letter any 阅读全文
posted @ 2021-03-03 13:49 Grandyang 阅读(2073) 评论(0) 推荐(0) 编辑
摘要: Given a string of lowercase letters, a duplicate removal consists of choosing two adjacent and equal letters, and removing them. We repeatedly make du 阅读全文
posted @ 2021-03-02 11:52 Grandyang 阅读(1232) 评论(0) 推荐(0) 编辑
摘要: We have a collection of stones, each stone has a positive integer weight. Each turn, we choose the two heaviest stones and smash them together. Suppos 阅读全文
posted @ 2021-03-01 12:31 Grandyang 阅读(1093) 评论(0) 推荐(0) 编辑
摘要: Given an integer array , you should partition the array into (contiguous) subarrays of length at most . After partitioning, each subarray has their va 阅读全文
posted @ 2021-03-01 08:51 Grandyang 阅读(1081) 评论(1) 推荐(0) 编辑
摘要: You have gardens, labeled from to , and an array where describes a bidirectional path between garden to garden . In each garden, you want to plant one 阅读全文
posted @ 2021-02-27 15:32 Grandyang 阅读(692) 评论(0) 推荐(0) 编辑
摘要: On an infinite plane, a robot initially stands at and faces north. The robot can receive one of three instructions: : go straight 1 unit; : turn 90 de 阅读全文
posted @ 2021-02-26 10:40 Grandyang 阅读(1411) 评论(0) 推荐(0) 编辑
摘要: On an infinite number line, the position of the i th stone is given by . Call a stone an endpoint stone if it has the smallest or largest position. Ea 阅读全文
posted @ 2021-02-25 13:47 Grandyang 阅读(553) 评论(0) 推荐(0) 编辑
摘要: You have a convex n-sided polygon where each vertex has an integer value. You are given an integer array values where values[i] is the value of the it 阅读全文
posted @ 2021-02-22 08:23 Grandyang 阅读(480) 评论(0) 推荐(0) 编辑
摘要: Given the of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum 阅读全文
posted @ 2021-02-21 16:17 Grandyang 阅读(560) 评论(0) 推荐(0) 编辑
摘要: In a 1 million by 1 million grid, the coordinates of each grid square are . We start at the square and want to reach the square. Each move, we can wal 阅读全文
posted @ 2021-02-21 07:42 Grandyang 阅读(918) 评论(0) 推荐(0) 编辑
摘要: A boomerang is a set of 3 points that are all distinct and not in a straight line. Given a list of three points in the plane, return whether these poi 阅读全文
posted @ 2021-02-20 14:45 Grandyang 阅读(376) 评论(0) 推荐(0) 编辑
摘要: We write the integers of and (in the order they are given) on two separate horizontal lines. Now, we may draw connecting lines : a straight line conne 阅读全文
posted @ 2021-02-19 13:53 Grandyang 阅读(744) 评论(0) 推荐(0) 编辑
摘要: Given a 2 dimensional of integers, each value in the grid represents the color of the grid square at that location. Two squares belong to the same con 阅读全文
posted @ 2021-02-18 14:38 Grandyang 阅读(563) 评论(1) 推荐(0) 编辑
摘要: Three stones are on a number line at positions , , and . Each turn, you pick up a stone at an endpoint (ie., either the lowest or highest position sto 阅读全文
posted @ 2021-02-17 15:05 Grandyang 阅读(417) 评论(0) 推荐(0) 编辑
摘要: Implement the class as follows: : Constructor, init the data structure with the given words. : returns true if and only if for some , the last charact 阅读全文
posted @ 2021-02-16 13:27 Grandyang 阅读(749) 评论(0) 推荐(1) 编辑
摘要: Given an array of non negative integers, return the maximum sum of elements in two non overlapping (contiguous) subarrays, which have lengths and . (F 阅读全文
posted @ 2021-02-15 14:45 Grandyang 阅读(919) 评论(0) 推荐(0) 编辑
摘要: We are given a matrix with rows and columns has cells with integer coordinates , where `0 这道题给了一个R行C列的矩阵,又给了一个起始点 (r0, c0),让按照离起始点的曼哈顿距离从小到大排序坐标点。博主最先 阅读全文
posted @ 2021-02-14 13:41 Grandyang 阅读(943) 评论(0) 推荐(0) 编辑
摘要: A company is planning to interview people. Given the array where , the cost of flying the person to city is , and the cost of flying the person to cit 阅读全文
posted @ 2021-02-14 10:01 Grandyang 阅读(1097) 评论(0) 推荐(1) 编辑
摘要: Given an array of integers, return the length of the longest arithmetic subsequence in . Recall that a subsequence of is a list with `0 这道题给了一个数组,让找最长 阅读全文
posted @ 2021-02-13 11:10 Grandyang 阅读(1535) 评论(1) 推荐(0) 编辑
摘要: Given the of a binary tree, find the maximum value for which there exist different nodes and where and is an ancestor of . A node is an ancestor of if 阅读全文
posted @ 2021-02-12 12:16 Grandyang 阅读(760) 评论(0) 推荐(0) 编辑
摘要: Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number on the chalkboard. On each player's turn, that player 阅读全文
posted @ 2021-02-11 14:31 Grandyang 阅读(1018) 评论(0) 推荐(0) 编辑
摘要: You are given a series of video clips from a sporting event that lasted T seconds. These video clips can be overlapping with each other and have varie 阅读全文
posted @ 2021-02-10 14:44 Grandyang 阅读(2157) 评论(2) 推荐(0) 编辑
摘要: A query word matches a given if we can insert lowercase letters to the pattern word so that it equals the . (We may insert each character at any posit 阅读全文
posted @ 2021-02-09 13:52 Grandyang 阅读(621) 评论(0) 推荐(0) 编辑
摘要: You are given the of a binary tree where each node has a value or . Each root to leaf path represents a binary number starting with the most significa 阅读全文
posted @ 2021-02-08 12:39 Grandyang 阅读(585) 评论(0) 推荐(0) 编辑
摘要: A valid parentheses string is either empty , , or , where and are valid parentheses strings, and represents string concatenation. For example, , , , a 阅读全文
posted @ 2021-02-08 02:19 Grandyang 阅读(724) 评论(0) 推荐(0) 编辑
摘要: Given a 2D array , each cell is 0 (representing sea) or 1 (representing land) A move consists of walking from one land square 4 directionally to anoth 阅读全文
posted @ 2021-02-07 15:19 Grandyang 阅读(641) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 44 下一页
Fork me on GitHub