原文链接: https://leetcode-cn.com/problems/reconstruct-a-2-row-binary-matrix 英文原文Given the following details of a matrix with n columns and 2 rows : The matrix is a binary matrix, which means each element in the matrix can be 0 or 1. The sum of elements …
分类详情
中等 分类
原文链接: https://leetcode-cn.com/problems/find-elements-in-a-contaminated-binary-tree 英文原文Given a binary tree with the following rules: root.val == 0 If treeNode.val == x and treeNode.left != null, then treeNode.left.val == 2 * x + 1 If treeNode.val == …
原文链接: https://leetcode-cn.com/problems/greatest-sum-divisible-by-three 英文原文Given an array nums of integers, we need to find the maximum possible sum of elements of the array such that it is divisible by three. Example 1: Input: nums = [3,6,5,1,8] Out…
原文链接: https://leetcode-cn.com/problems/count-servers-that-communicate 英文原文You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that it is no server. Two serv…
原文链接: https://leetcode-cn.com/problems/search-suggestions-system 英文原文Given an array of strings products and a string searchWord. We want to design a system that suggests at most three product names from products after each character of searchWord is …
原文链接: https://leetcode-cn.com/problems/number-of-burgers-with-no-waste-of-ingredients 英文原文Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows: Jumbo Burger: 4 tomato slices and 1 cheese slice. Small B…
原文链接: https://leetcode-cn.com/problems/count-square-submatrices-with-all-ones 英文原文Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1: Input: matrix = [ [0,1,1,1], [1,1,1,1], [0,1,1,1] ] Output: 15 Expl…
原文链接: https://leetcode-cn.com/problems/group-the-people-given-the-group-size-they-belong-to 英文原文There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1. You are given an integer ar…
原文链接: https://leetcode-cn.com/problems/find-the-smallest-divisor-given-a-threshold 英文原文Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division's result. Fin…
原文链接: https://leetcode-cn.com/problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold 英文原文Given a m x n matrix mat and an integer threshold. Return the maximum side-length of a square with a sum less than or equal to thresho…
原文链接: https://leetcode-cn.com/problems/divide-array-in-sets-of-k-consecutive-numbers 英文原文Given an array of integers nums and a positive integer k, find whether it is possible to divide this array into sets of k consecutive numbers. Return true if it …
原文链接: https://leetcode-cn.com/problems/maximum-number-of-occurrences-of-a-substring 英文原文Given a string s, return the maximum number of ocurrences of any substring under the following rules: The number of unique characters in the substring must be les…
原文链接: https://leetcode-cn.com/problems/all-elements-in-two-binary-search-trees 英文原文Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: root1 = [2,1,4], …
原文链接: https://leetcode-cn.com/problems/jump-game-iii 英文原文Given an array of non-negative integers arr, you are initially positioned at start index of the array. When you are at index i, you can jump to i + arr[i] or i - arr[i], check if you can reach …
原文链接: https://leetcode-cn.com/problems/xor-queries-of-a-subarray 英文原文You are given an array arr of positive integers. You are also given the array queries where queries[i] = [lefti, righti]. For each query i compute the XOR of elements from lefti to …
原文链接: https://leetcode-cn.com/problems/get-watched-videos-by-your-friends 英文原文There are n people, each person has a unique id between 0 and n-1. Given the arrays watchedVideos and friends, where watchedVideos[i] and friends[i] contain the list of wat…
原文链接: https://leetcode-cn.com/problems/minimum-flips-to-make-a-or-b-equal-to-c 英文原文Given 3 positives numbers a, b and c. Return the minimum flips required in some bits of a and b to make ( a OR b == c ). (bitwise OR operation). Flip operation consist…
原文链接: https://leetcode-cn.com/problems/number-of-operations-to-make-network-connected 英文原文There are n computers numbered from 0 to n-1 connected by ethernet cables connections forming a network where connections[i] = [a, b] represents a connection be…
原文链接: https://leetcode-cn.com/problems/number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold 英文原文Given an array of integers arr and two integers k and threshold. Return the number of sub-arrays of size k and average greater th…
原文链接: https://leetcode-cn.com/problems/angle-between-hands-of-a-clock 英文原文Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minute hand. Example 1: Input: hour = 12, minutes = 30 Output: 165 Ex…
原文链接: https://leetcode-cn.com/problems/print-words-vertically 英文原文Given a string s. Return all the words vertically in the same order in which they appear in s. Words are returned as a list of strings, complete with spaces when is necessary. (Trailin…
原文链接: https://leetcode-cn.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance 英文原文Given the array restaurants where restaurants[i] = [idi, ratingi, veganFriendlyi, pricei, distancei]. You have to filter the restaurants using three fi…
原文链接: https://leetcode-cn.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance 英文原文There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional …
原文链接: https://leetcode-cn.com/problems/apply-discount-every-n-orders 英文原文There is a supermarket that is frequented by many customers. The products sold at the supermarket are represented as two parallel integer arrays products and prices, where the i…
原文链接: https://leetcode-cn.com/problems/number-of-substrings-containing-all-three-characters 英文原文Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters a, b…
原文链接: https://leetcode-cn.com/problems/reduce-array-size-to-the-half 英文原文You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the set so that at…
原文链接: https://leetcode-cn.com/problems/maximum-product-of-splitted-binary-tree 英文原文Given the root of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is maximized. Return th…
原文链接: 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…