原文链接: https://leetcode-cn.com/problems/check-if-n-and-its-double-exist 英文原文Given an array arr of integers, check if there exists two integers N and M such that N is the double of M ( i.e. N = 2 * M). More formally check if there exists two indices i …
标签详情
哈希表 分类
原文链接: https://leetcode-cn.com/problems/minimum-number-of-steps-to-make-two-strings-anagram 英文原文Given two equal-size strings s and t. In one step you can choose any character of t and replace it with another character. Return the minimum number of ste…
原文链接: https://leetcode-cn.com/problems/tweet-counts-per-frequency 英文原文A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These periods can be partitioned into sma…
原文链接: https://leetcode-cn.com/problems/find-the-longest-substring-containing-vowels-in-even-counts 英文原文Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' mu…
原文链接: https://leetcode-cn.com/problems/how-many-numbers-are-smaller-than-the-current-number 英文原文Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number …
原文链接: https://leetcode-cn.com/problems/cinema-seat-allocation 英文原文 A cinema has n rows of seats, numbered from 1 to n and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the array reservedSeats containing th…
原文链接: https://leetcode-cn.com/problems/count-largest-group 英文原文Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return how many groups have the largest size. Example 1: Input: n = 13 Output: 4 Explanation: Th…
原文链接: https://leetcode-cn.com/problems/construct-k-palindrome-strings 英文原文Given a string s and an integer k. You should construct k non-empty palindrome strings using all the characters in s. Return True if you can use all the characters in s to cons…
原文链接: https://leetcode-cn.com/problems/find-lucky-integer-in-an-array 英文原文Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value. Return a lucky integer in the array. If there are multiple …
原文链接: https://leetcode-cn.com/problems/design-underground-system 英文原文An underground railway system is keeping track of customer travel times between different stations. They are using this data to calculate the average time it takes to travel from on…
原文链接: https://leetcode-cn.com/problems/html-entity-parser 英文原文HTML entity parser is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself. The special characters and their entities fo…
原文链接: https://leetcode-cn.com/problems/display-table-of-food-orders-in-a-restaurant 英文原文Given the array orders, which represents the orders that customers have done in a restaurant. More specifically orders[i]=[customerNamei,tableNumberi,foodItemi] w…
原文链接: https://leetcode-cn.com/problems/destination-city 英文原文You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path…
原文链接: https://leetcode-cn.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor 英文原文Given an array of integers arr. We want to select three indices i, j and k where (0 <= i < j <= k < arr.length). Let's define a and b as follows: a = arr[…
原文链接: https://leetcode-cn.com/problems/minimum-time-to-collect-all-apples-in-a-tree 英文原文Given an undirected tree consisting of n vertices numbered from 0 to n-1, which has some apples in their vertices. You spend 1 second to walk over one edge of the…
原文链接: https://leetcode-cn.com/problems/make-two-arrays-equal-by-reversing-sub-arrays 英文原文Given two integer arrays of equal length target and arr. In one step, you can select any non-empty sub-array of arr and reverse it. You are allowed to make any n…
原文链接: https://leetcode-cn.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k 英文原文Given a binary string s and an integer k. Return true if every binary code of length k is a substring of s. Otherwise, return false. Example 1: Input: s …
原文链接: https://leetcode-cn.com/problems/least-number-of-unique-integers-after-k-removals 英文原文Given an array of integers arr and an integer k. Find the least number of unique integers after removing exactly k elements. Example 1: Input: arr = [5,5,4], …
原文链接: https://leetcode-cn.com/problems/avoid-flood-in-the-city 英文原文Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the nth lake, the nth lake becomes full of water. If it rains over a lake whic…
原文链接: https://leetcode-cn.com/problems/path-crossing 英文原文Given a string path, where path[i] = 'N', 'S', 'E' or 'W', each representing moving one unit north, south, east, or west, respectively. You start at the origin (0, 0) on a 2D plane and walk on …
原文链接: https://leetcode-cn.com/problems/check-if-array-pairs-are-divisible-by-k 英文原文Given an array of integers arr of even length n and an integer k. We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k…
原文链接: https://leetcode-cn.com/problems/number-of-good-pairs 英文原文Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. Example 1: Input: nums = [1,2,3,1,1,3] Output: 4 Explanati…
原文链接: https://leetcode-cn.com/problems/can-convert-string-in-k-moves 英文原文Given two strings s and t, your goal is to convert s into t in k moves or less. During the ith (1 <= i <= k) move you can: Choose any index j (1-indexed) from s, such that 1 <= …
原文链接: https://leetcode-cn.com/problems/maximum-number-of-non-overlapping-subarrays-with-sum-equals-target 英文原文Given an array nums and an integer target. Return the maximum number of non-empty non-overlapping subarrays such that the sum of values in e…
原文链接: https://leetcode-cn.com/problems/find-longest-awesome-substring 英文原文Given a string s. An awesome substring is a non-empty substring of s such that we can make any number of swaps in order to make it palindrome. Return the length of the maximum …
原文链接: https://leetcode-cn.com/problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers 英文原文Given two arrays of integers nums1 and nums2, return the number of triplets formed (type 1 and type 2) under the following rules: Type…
原文链接: https://leetcode-cn.com/problems/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period 英文原文LeetCode company workers use key-cards to unlock office doors. Each time a worker uses their key-card, the security system saves the worker'…
原文链接: https://leetcode-cn.com/problems/split-a-string-into-the-max-number-of-unique-substrings 英文原文Given a string s, return the maximum number of unique substrings that the given string can be split into. You can split string s into any list of non-e…
原文链接: https://leetcode-cn.com/problems/throne-inheritance 英文原文A kingdom consists of a king, his children, his grandchildren, and so on. Every once in a while, someone in the family dies or a child is born. The kingdom has a well-defined order of inhe…
原文链接: https://leetcode-cn.com/problems/sort-array-by-increasing-frequency 英文原文Given an array of integers nums, sort the array in increasing order based on the frequency of the values. If multiple values have the same frequency, sort them in decreasin…