原文链接: https://leetcode-cn.com/problems/minimize-malware-spread-ii 英文原文You are given a network of n nodes represented as an n x n adjacency matrix graph, where the ith node is directly connected to the jth node if graph[i][j] == 1. Some nodes initial …
分类详情
困难 分类
原文链接: https://leetcode-cn.com/problems/stamping-the-sequence 英文原文You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'. In one turn, you can place stamp over s and replace every letter…
原文链接: https://leetcode-cn.com/problems/find-the-shortest-superstring 英文原文Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smallest length, return…
原文链接: https://leetcode-cn.com/problems/largest-component-size-by-common-factor 英文原文You are given an integer array of unique positive integers nums. Consider the following graph: There are nums.length nodes, labeled nums[0] to nums[nums.length - 1], T…
原文链接: https://leetcode-cn.com/problems/tallest-billboard 英文原文You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height. You are give…
原文链接: https://leetcode-cn.com/problems/delete-columns-to-make-sorted-iii 英文原文You are given an array of n strings strs, all of the same length. We may choose any deletion indices, and we delete all the characters in those indices for each string. For …
原文链接: https://leetcode-cn.com/problems/least-operators-to-express-number 英文原文Given a single positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where each operator op1, op2, etc. is either addition, subtraction, …
原文链接: https://leetcode-cn.com/problems/binary-tree-cameras 英文原文You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children. Return the minimum nu…
原文链接: https://leetcode-cn.com/problems/equal-rational-numbers 英文原文Given two strings s and t, each of which represents a non-negative rational number, return true if and only if they represent the same number. The strings may use parentheses to denote…
原文链接: https://leetcode-cn.com/problems/odd-even-jump 英文原文You are given an integer array arr. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called odd-numbered jumps, and the (2nd, 4th, 6th,…
原文链接: https://leetcode-cn.com/problems/unique-paths-iii 英文原文You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exactly one starting square. 2 representing the ending square. There is exac…
原文链接: https://leetcode-cn.com/problems/triples-with-bitwise-and-equal-to-zero 英文原文Given an integer array nums, return the number of AND triples. An AND triple is a triple of indices (i, j, k) such that: 0 <= i < nums.length 0 <= j < nums.length 0 <= …
原文链接: https://leetcode-cn.com/problems/vertical-order-traversal-of-a-binary-tree 英文原文Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (row, col), its left and right children will be…
原文链接: https://leetcode-cn.com/problems/subarrays-with-k-different-integers 英文原文Given an integer array nums and an integer k, return the number of good subarrays of nums. A good array is an array where the number of different integers in that array is…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-k-consecutive-bit-flips 英文原文You are given a binary array nums and an integer k. A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to …
原文链接: https://leetcode-cn.com/problems/number-of-squareful-arrays 英文原文An array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, return the number of permutations of nums that are squareful. …
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-merge-stones 英文原文There are n piles of stones arranged in a row. The ith pile has stones[i] stones. A move consists of merging exactly k consecutive piles into one pile, and the cost of this move …
原文链接: https://leetcode-cn.com/problems/grid-illumination 英文原文There is a 2D grid of size n x n where each cell of this grid has a lamp that is initially turned off. You are given a 2D array of lamp positions lamps, where lamps[i] = [rowi, coli] indica…
原文链接: https://leetcode-cn.com/problems/numbers-with-repeated-digits 英文原文Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit. Example 1: Input: n = 20 Output: 1 Explanation: The only pos…
原文链接: https://leetcode-cn.com/problems/recover-a-tree-from-preorder-traversal 英文原文We run a preorder depth-first search (DFS) on the root of a binary tree. At each node in this traversal, we output D dashes (where D is the depth of this node), then we…
原文链接: https://leetcode-cn.com/problems/stream-of-characters 英文原文Design an algorithm that accepts a stream of characters and checks if a suffix of these characters is a string of a given array of strings words. For example, if words = ["abc", "xyz"] a…
原文链接: https://leetcode-cn.com/problems/escape-a-large-maze 英文原文There is a 1 million by 1 million grid on an XY-plane, and the coordinates of each grid square are (x, y). We start at the source = [sx, sy] square and want to reach the target = [tx, ty]…
原文链接: https://leetcode-cn.com/problems/longest-duplicate-substring 英文原文Given a string s, consider all duplicated substrings: (contiguous) substrings of s that occur 2 or more times. The occurrences may overlap. Return any duplicated substring that ha…
原文链接: https://leetcode-cn.com/problems/last-substring-in-lexicographical-order 英文原文Given a string s, return the last substring of s in lexicographical order. Example 1: Input: s = "abab" Output: "bab" Explanation: The substrings are ["a", "ab", "aba"…
原文链接: https://leetcode-cn.com/problems/number-of-submatrices-that-sum-to-target 英文原文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[x][y] with x1 <=…
原文链接: https://leetcode-cn.com/problems/shortest-common-supersequence 英文原文Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them. A string s is a…
原文链接: https://leetcode-cn.com/problems/find-in-mountain-array 英文原文(This problem is an interactive problem.) You may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some i with 0 < i < arr.length - 1 such that…
原文链接: https://leetcode-cn.com/problems/brace-expansion-ii 中文题目如果你熟悉 Shell 编程,那么一定了解过花括号展开,它可以用来生成任意字符串。 花括号展开的表达式可以看作一个由 花括号、逗号 和 小写英文字母 组成的字符串,定义下面几条语法规则: 如果只给出单一的元素 x,那么表达式表示的字符串就只有 "x"。R(x) = {x} <ul> <li>例如,表达式 <code>"a"</code> 表示字符串 <c…
原文链接: https://leetcode-cn.com/problems/parsing-a-boolean-expression 英文原文Return the result of evaluating a given boolean expression, represented as a string. An expression can either be: "t", evaluating to True; "f", evaluating to False; "!(expr)", ev…
原文链接: https://leetcode-cn.com/problems/smallest-sufficient-team 英文原文In a project, you have a list of required skills req_skills, and a list of people. The ith person people[i] contains a list of skills that the person has. Consider a sufficient team:…