原文链接: https://leetcode-cn.com/problems/frog-jump 英文原文A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water. …
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/queue-reconstruction-by-height 英文原文You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the ith person of …
原文链接: https://leetcode-cn.com/problems/trapping-rain-water-ii 英文原文Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining. Example 1: Input: heightM…
原文链接: https://leetcode-cn.com/problems/split-array-largest-sum 英文原文Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest…
原文链接: https://leetcode-cn.com/problems/third-maximum-number 英文原文Given an integer array nums, return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number. Example 1: Input: nums = [3,2,1] Outp…
原文链接: https://leetcode-cn.com/problems/partition-equal-subset-sum 英文原文Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Exampl…
原文链接: https://leetcode-cn.com/problems/pacific-atlantic-water-flow 英文原文There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touc…
原文链接: https://leetcode-cn.com/problems/battleships-in-a-board 英文原文Given an m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on board. Battleships can only be placed horizontally or vertically o…
原文链接: https://leetcode-cn.com/problems/maximum-xor-of-two-numbers-in-an-array 英文原文Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n. Example 1: Input: nums = [3,10,5,25,2,8] Output: 28 Explanation: T…
原文链接: https://leetcode-cn.com/problems/non-overlapping-intervals 英文原文Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlappin…
原文链接: https://leetcode-cn.com/problems/find-right-interval 英文原文You are given an array of intervals, where intervals[i] = [starti, endi] and each starti is unique. The right interval for an interval i is an interval j such that startj >= endi and star…
原文链接: https://leetcode-cn.com/problems/find-all-duplicates-in-an-array 英文原文Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears once or twice, return an array of all the integers that…
原文链接: https://leetcode-cn.com/problems/arithmetic-slices-ii-subsequence 英文原文Given an integer array nums, return the number of all the arithmetic subsequences of nums. A sequence of numbers is called arithmetic if it consists of at least three element…
原文链接: https://leetcode-cn.com/problems/number-of-boomerangs 英文原文You are given n points in the plane that are all distinct, where points[i] = [xi, yi]. A boomerang is a tuple of points (i, j, k) such that the distance between i and j equals the distan…
原文链接: https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array 英文原文Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums. Example 1:…
原文链接: https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements 英文原文Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment n - 1 elements of the…
原文链接: https://leetcode-cn.com/problems/4sum-ii 英文原文Given four integer arrays nums1, nums2, nums3, and nums4 all of length n, return the number of tuples (i, j, k, l) such that: 0 <= i, j, k, l < n nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0 Exampl…
原文链接: https://leetcode-cn.com/problems/assign-cookies 英文原文Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum siz…
原文链接: https://leetcode-cn.com/problems/132-pattern 英文原文Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132…
原文链接: https://leetcode-cn.com/problems/circular-array-loop 英文原文You are playing a game involving a circular array of non-zero integers nums. Each nums[i] denotes the number of indices forward/backward you must move if you are located at index i: If nu…
原文链接: https://leetcode-cn.com/problems/minimum-moves-to-equal-array-elements-ii 英文原文Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal. In one move, you can increment or decrement an el…
原文链接: https://leetcode-cn.com/problems/concatenated-words 英文原文Given an array of strings words (without duplicates), return all the concatenated words in the given list of words. A concatenated word is defined as a string that is comprised entirely of…
原文链接: https://leetcode-cn.com/problems/ones-and-zeroes 英文原文You are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset. A set x is a s…
原文链接: https://leetcode-cn.com/problems/matchsticks-to-square 英文原文You are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one square. You should not break any sti…
原文链接: https://leetcode-cn.com/problems/total-hamming-distance 英文原文The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given an integer array nums, return the sum of Hamming distances bet…
原文链接: https://leetcode-cn.com/problems/sliding-window-median 英文原文The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values. For examples, i…
原文链接: https://leetcode-cn.com/problems/max-consecutive-ones 英文原文Given a binary array nums, return the maximum number of consecutive 1's in the array. Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three…
原文链接: https://leetcode-cn.com/problems/predict-the-winner 英文原文You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players sta…
原文链接: https://leetcode-cn.com/problems/kth-smallest-instructions 英文原文Bob is standing at cell (0, 0), and he wants to reach destination: (row, column). He can only travel right and down. You are going to help Bob by providing instructions for him to r…
原文链接: https://leetcode-cn.com/problems/increasing-subsequences 英文原文Given an integer array nums, return all the different possible increasing subsequences of the given array with at least two elements. You may return the answer in any order. The given…