原文链接: https://leetcode-cn.com/problems/count-substrings-that-differ-by-one-character 英文原文Given two strings s and t, find the number of ways you can choose a non-empty substring of s and replace a single character by a different character such that th…
标签详情
哈希表 分类
原文链接: https://leetcode-cn.com/problems/largest-substring-between-two-equal-characters 英文原文Given a string s, return the length of the longest substring between two equal characters, excluding the two characters. If there is no such substring return -1…
原文链接: https://leetcode-cn.com/problems/check-array-formation-through-concatenation 英文原文You are given an array of distinct integers arr and an array of integer arrays pieces, where the integers in pieces are distinct. Your goal is to form arr by conca…
原文链接: https://leetcode-cn.com/problems/design-an-ordered-stream 英文原文There is a stream of n (idKey, value) pairs arriving in an arbitrary order, where idKey is an integer between 1 and n and value is a string. No two pairs have the same id. Design a s…
原文链接: https://leetcode-cn.com/problems/minimum-operations-to-reduce-x-to-zero 英文原文You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its…
原文链接: https://leetcode-cn.com/problems/determine-if-two-strings-are-close 英文原文Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. <ul> <li>For example, <…
原文链接: https://leetcode-cn.com/problems/largest-color-value-in-a-directed-graph 英文原文There is a directed graph of n colored nodes and m edges. The nodes are numbered from 0 to n - 1. You are given a string colors where colors[i] is a lowercase English …
原文链接: https://leetcode-cn.com/problems/substrings-of-size-three-with-distinct-characters 英文原文A string is good if there are no repeated characters. Given a string s, return the number of good substrings of length three in s. Note that if th…
原文链接: https://leetcode-cn.com/problems/finding-pairs-with-a-certain-sum 英文原文You are given two integer arrays nums1 and nums2. You are tasked to implement a data structure that supports queries of two types: Add a positive integer to an element of a g…
原文链接: https://leetcode-cn.com/problems/check-if-all-the-integers-in-a-range-are-covered 英文原文You are given a 2D integer array ranges and two integers left and right. Each ranges[i] = [starti, endi] represents an inclusive interval between starti and e…
原文链接: https://leetcode-cn.com/problems/design-movie-rental-system 英文原文You have a movie renting company consisting of n shops. You want to implement a renting system that supports searching for, booking, and returning movies. The system should also su…
原文链接: https://leetcode-cn.com/problems/redistribute-characters-to-make-all-strings-equal 英文原文You are given an array of strings words (0-indexed). In one operation, pick two distinct indices i and j, where words[i] is a non-empty string, and move any …
原文链接: https://leetcode-cn.com/problems/minimum-absolute-difference-queries 英文原文The minimum absolute difference of an array a is defined as the minimum value of |a[i] - a[j]|, where 0 <= i < j < a.length and a[i] != a[j]. If all elements of a are the …
原文链接: https://leetcode-cn.com/problems/number-of-wonderful-substrings 英文原文A wonderful string is a string where at most one letter appears an odd number of times. For example, "ccjjc" and "abab" are wonderful, but "ab" is not. Given a string word that…
原文链接: https://leetcode-cn.com/problems/check-if-all-characters-have-equal-number-of-occurrences 英文原文Given a string s, return true if s is a good string, or false otherwise. A string s is good if all the characters that appear in s have the same numbe…
原文链接: https://leetcode-cn.com/problems/unique-length-3-palindromic-subsequences 英文原文Given a string s, return the number of unique palindromes of length three that are a subsequence of s. Note that even if there are multiple ways to obtain the same su…
原文链接: https://leetcode-cn.com/problems/merge-bsts-to-create-single-bst 英文原文You are given n BST (binary search tree) root nodes for n separate BSTs stored in an array trees (0-indexed). Each BST in trees has at most 3 nodes, and no two roots have the …
原文链接: https://leetcode-cn.com/problems/delete-duplicate-folders-in-system 英文原文Due to a bug, there are many duplicate folders in a file system. You are given a 2D array paths, where paths[i] is an array representing an absolute path to the ith folder …
原文链接: https://leetcode-cn.com/problems/operations-on-tree 英文原文You are given a tree with n nodes numbered from 0 to n - 1 in the form of a parent array parent where parent[i] is the parent of the ith node. The root of the tree is node 0, so parent[0] …
原文链接: https://leetcode-cn.com/problems/find-original-array-from-doubled-array 英文原文An integer array original is transformed into a doubled array changed by appending twice the value of every element in original, and then randomly shuffling the resulti…
原文链接: https://leetcode-cn.com/problems/number-of-pairs-of-interchangeable-rectangles 英文原文You are given n rectangles represented by a 0-indexed 2D integer array rectangles, where rectangles[i] = [widthi, heighti] denotes the width and height of the it…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-ways-to-partition-an-array 英文原文You are given a 0-indexed integer array nums of length n. The number of ways to partition nums is the number of pivot indices that satisfy both conditions: 1 <= p…
原文链接: https://leetcode-cn.com/problems/detect-squares 英文原文You are given a stream of points on the X-Y plane. Design an algorithm that: Adds new points from the stream into a data structure. Duplicate points are allowed and should be treated as differ…
原文链接: https://leetcode-cn.com/problems/two-out-of-three 英文原文Given three integer arrays nums1, nums2, and nums3, return a distinct array containing all the values that are present in at least two out of the three arrays. You may return the values in a…
原文链接: https://leetcode-cn.com/problems/stock-price-fluctuation 英文原文You are given a stream of records about a particular stock. Each record contains a timestamp and the corresponding price of the stock at that timestamp. Unfortunately due to the volat…
原文链接: https://leetcode-cn.com/problems/kth-distinct-string-in-an-array 英文原文A distinct string is a string that is present only once in an array. Given an array of strings arr, and an integer k, return the kth distinct string present in arr. If there a…
原文链接: https://leetcode-cn.com/problems/check-whether-two-strings-are-almost-equivalent 英文原文Two strings word1 and word2 are considered almost equivalent if the differences between the frequencies of each letter from 'a' to 'z' between word1 and word2 …
原文链接: https://leetcode-cn.com/problems/count-vowel-substrings-of-a-string 英文原文A substring is a contiguous (non-empty) sequence of characters within a string. A vowel substring is a substring that only consists of vowels ('a', 'e', 'i', 'o', and 'u') …
原文链接: https://leetcode-cn.com/problems/count-common-words-with-one-occurrence 英文原文Given two string arrays words1 and words2, return the number of strings that appear exactly once in each of the two arrays. Example 1: Input: words1 = ["leetcode","is",…
原文链接: https://leetcode-cn.com/problems/programmable-robot 中文题目力扣团队买了一个可编程机器人,机器人初始位置在原点(0, 0)。小伙伴事先给机器人输入一串指令command,机器人就会无限循环这条指令的步骤进行移动。指令有两种: U: 向y轴正方向移动一格 R: 向x轴正方向移动一格。 不幸的是,在 xy 平面上还有一些障碍物,他们的坐标用obstacles表示。机器人一旦碰到障碍物就会被损毁。 给定终点坐标(x, y),返回机器人能否…