原文链接: https://leetcode-cn.com/problems/accounts-merge 英文原文Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of t…
分类详情
中等 分类
原文链接: https://leetcode-cn.com/problems/remove-comments 英文原文Given a C++ program, remove comments from it. The program source is an array of strings source where source[i] is the ith line of the source code. This represents the result of splitting the …
原文链接: https://leetcode-cn.com/problems/split-linked-list-in-parts 英文原文Given the head of a singly linked list and an integer k, split the linked list into k consecutive linked list parts. The length of each part should be as equal as possible: no two …
原文链接: https://leetcode-cn.com/problems/my-calendar-i 英文原文You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty …
原文链接: https://leetcode-cn.com/problems/my-calendar-ii 英文原文You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a triple booking. A triple booking happens when three events have some non-emp…
原文链接: https://leetcode-cn.com/problems/asteroid-collision 英文原文We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive mean…
原文链接: https://leetcode-cn.com/problems/monotone-increasing-digits 英文原文An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y. Given an integer n, return the largest number that is less than or equ…
原文链接: https://leetcode-cn.com/problems/daily-temperatures 英文原文Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warm…
原文链接: https://leetcode-cn.com/problems/delete-and-earn 英文原文You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times: Pick any nums[i] and delete it to earn nums[i…
原文链接: https://leetcode-cn.com/problems/network-delay-time 英文原文You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node, vi is the …
原文链接: https://leetcode-cn.com/problems/reach-a-number 英文原文You are standing at position 0 on an infinite number line. There is a destination at position target. You can make some number of moves numMoves so that: On each move, you can either go left o…
原文链接: https://leetcode-cn.com/problems/pyramid-transition-matrix 英文原文You are stacking blocks to form a pyramid. Each block has a color, which is represented by a single letter. Each row of blocks contains one less block than the row beneath it and is…
原文链接: https://leetcode-cn.com/problems/flatten-a-multilevel-doubly-linked-list 英文原文You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional child pointer. This child pointer may or may n…
原文链接: https://leetcode-cn.com/problems/partition-labels 英文原文You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Return a list of integers representing the size of t…
原文链接: https://leetcode-cn.com/problems/largest-plus-sign 英文原文You are given an integer n. You have an n x n binary grid grid with all values initially 1's except for some indices given in the array mines. The ith element of the array mines is defined …
原文链接: https://leetcode-cn.com/problems/construct-quad-tree 英文原文Given a n * n matrix grid of 0's and 1's only. We want to represent the grid with a Quad-Tree. Return the root of the Quad-Tree representing the grid. Notice that you can assign the value…
原文链接: https://leetcode-cn.com/problems/logical-or-of-two-binary-grids-represented-as-quad-trees 英文原文A Binary Matrix is a matrix in which all the elements are either 0 or 1. Given quadTree1 and quadTree2. quadTree1 represents a n * n binary matrix and…
原文链接: https://leetcode-cn.com/problems/reorganize-string 英文原文Given a string s, rearrange the characters of s so that any two adjacent characters are not the same. Return any possible rearrangement of s or return "" if not possible. Example 1: Input: …
原文链接: https://leetcode-cn.com/problems/max-chunks-to-make-sorted 英文原文You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1]. We split arr into some number of chunks (i.e., partitions), and…
原文链接: https://leetcode-cn.com/problems/insert-into-a-binary-search-tree 英文原文You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the …
原文链接: https://leetcode-cn.com/problems/global-and-local-inversions 英文原文You are given an integer array nums of length n which represents a permutation of all the integers in the range [0, n - 1]. The number of global inversions is the number of the di…
原文链接: https://leetcode-cn.com/problems/swap-adjacent-in-lr-string 英文原文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 replacing one occurrence of "RX" wi…
原文链接: https://leetcode-cn.com/problems/k-th-symbol-in-grammar 英文原文We build a table of n rows (1-indexed). We start by writing 0 in the 1st row. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and eac…
原文链接: https://leetcode-cn.com/problems/letter-case-permutation 英文原文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 strings we could create. You can retu…
原文链接: https://leetcode-cn.com/problems/is-graph-bipartite 英文原文There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. …
原文链接: https://leetcode-cn.com/problems/cheapest-flights-within-k-stops 英文原文There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi…
原文链接: https://leetcode-cn.com/problems/rotated-digits 英文原文An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be rotated - we cannot choose to leave it alone…
原文链接: https://leetcode-cn.com/problems/escape-the-ghosts 英文原文You are playing a simplified PAC-MAN game on an infinite 2-D grid. You start at the point [0, 0], and you are given a destination point target = [xtarget, ytarget] that you are trying to ge…
原文链接: https://leetcode-cn.com/problems/domino-and-tromino-tiling 英文原文You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the number of ways to tile an 2 x n board. Since the a…
原文链接: https://leetcode-cn.com/problems/custom-sort-string 英文原文You are given two strings order and s. All the words of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that orde…