原文链接: https://leetcode-cn.com/problems/check-if-it-is-a-good-array 英文原文Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. The array is said to be good i…
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/cells-with-odd-values-in-a-matrix 英文原文There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some in…
原文链接: 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/maximum-score-words-formed-by-letters 英文原文Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words formed by using the g…
原文链接: https://leetcode-cn.com/problems/shift-2d-grid 英文原文Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j + 1]. Element at grid[i][n - 1] moves to gri…
原文链接: 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/minimum-moves-to-move-a-box-to-their-target-location 英文原文A storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations. The game is represented by an m x n…
原文链接: https://leetcode-cn.com/problems/minimum-time-visiting-all-points 英文原文On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points. You …
原文链接: 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/find-winner-on-a-tic-tac-toe-game 英文原文Tic-tac-toe is played by two players A and B on a 3 x 3 grid. The rules of Tic-Tac-Toe are: Players take turns placing characters into empty squares ' '. The first player A …
原文链接: 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/minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix 英文原文Given a m x n binary matrix mat. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is chang…
原文链接: 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/shortest-path-in-a-grid-with-obstacles-elimination 英文原文You are given an m x n integer matrix grid where each cell is either 0 (empty) or 1 (obstacle). You can move up, down, left, or right from and to an empty c…
原文链接: https://leetcode-cn.com/problems/find-numbers-with-even-number-of-digits 英文原文Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contain…
原文链接: 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-candies-you-can-get-from-boxes 英文原文Given n boxes, each box is given in the format [status, candies, keys, containedBoxes] where: status[i]: an integer which is 1 if box[i] is open and 0 if box[i] is clos…
原文链接: https://leetcode-cn.com/problems/find-n-unique-integers-sum-up-to-zero 英文原文Given an integer n, return any array containing n unique integers such that they add up to 0. Example 1: Input: n = 5 Output: [-7,-1,1,3,4] Explanation: These arrays als…
原文链接: 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/verbal-arithmetic-puzzle 英文原文Given an equation, represented by words on left side and the result on right side. You need to check if the equation is solvable under the following rules: Each character is decoded …
原文链接: 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/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/jump-game-iv 英文原文Given an array of integers arr, you are initially positioned at the first index of the array. In one step you can jump from index i to index: i + 1 where: i + 1 < arr.length. i - 1 where: i - 1 …
原文链接: 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/minimum-number-of-taps-to-open-to-water-a-garden 英文原文There is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e The length of the garden is n). There are n + …
原文链接: 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…