原文链接: https://leetcode-cn.com/problems/shifting-letters 英文原文You are given a string s of lowercase English letters and an integer array shifts of the same length. Call the shift() of a letter, the next letter in the alphabet, (wrapping around so that …
标签详情
数组 分类
原文链接: https://leetcode-cn.com/problems/rectangle-area-ii 英文原文You are given a 2D array of axis-aligned rectangles. Each rectangle[i] = [xi1, yi1, xi2, yi2] denotes the ith rectangle where (xi1, yi1) are the coordinates of the bottom-left corner, and (…
原文链接: https://leetcode-cn.com/problems/maximize-distance-to-closest-person 英文原文You are given an array representing a row of seats where seats[i] = 1 represents a person sitting in the ith seat, and seats[i] = 0 represents that the ith seat is empty (…
原文链接: https://leetcode-cn.com/problems/peak-index-in-a-mountain-array 英文原文Let's call an array arr a mountain if the following properties hold: arr.length >= 3 There exists some i with 0 < i < arr.length - 1 such that: arr[0] < arr[1] < ... arr[i-1] <…
原文链接: https://leetcode-cn.com/problems/car-fleet 英文原文There are n cars going to the same destination along a one-lane road. The destination is target miles away. You are given two integer array position and speed, both of length n, where position[i] i…
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-hire-k-workers 英文原文There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith…
原文链接: https://leetcode-cn.com/problems/lemonade-change 英文原文At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bills). Each customer will only buy one lemo…
原文链接: https://leetcode-cn.com/problems/score-after-flipping-matrix 英文原文You are given an m x n binary matrix grid. A move consists of choosing any row or column and toggling each value in that row or column (i.e., changing all 0's to 1's, and all 1's …
原文链接: https://leetcode-cn.com/problems/transpose-matrix 英文原文Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix's row and column indices. Exampl…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-refueling-stops 英文原文A car travels from a starting position to a destination which is target miles east of the starting position. There are gas stations along the way. The gas stations are repre…
原文链接: https://leetcode-cn.com/problems/advantage-shuffle 英文原文You are given two integer arrays nums1 and nums2 both of the same length. The advantage of nums1 with respect to nums2 is the number of indices i for which nums1[i] > nums2[i]. Return any p…
原文链接: https://leetcode-cn.com/problems/length-of-longest-fibonacci-subsequence 英文原文A sequence x1, x2, ..., xn is Fibonacci-like if: n >= 3 xi + xi+1 == xi+2 for all i + 2 <= n Given a strictly increasing array arr of positive integers forming a seque…
原文链接: https://leetcode-cn.com/problems/walking-robot-simulation 英文原文A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot can receive a sequence of these three possible types of commands: -2: Turn left 90 degrees. -1: Turn ri…
原文链接: https://leetcode-cn.com/problems/koko-eating-bananas 英文原文Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko can decide her bananas-per-hour eating…
原文链接: https://leetcode-cn.com/problems/stone-game 英文原文Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to…
原文链接: https://leetcode-cn.com/problems/profitable-schemes 英文原文There is a group of n members, and a list of various crimes they could commit. The ith crime generates a profit[i] and requires group[i] members to participate in it. If a member participa…
原文链接: https://leetcode-cn.com/problems/loud-and-rich 英文原文There is a group of n people labeled from 0 to n - 1 where each person has a different amount of money and a different level of quietness. You are given an array richer where richer[i] = [ai, b…
原文链接: https://leetcode-cn.com/problems/shortest-subarray-with-sum-at-least-k 英文原文Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no such subarray, return…
原文链接: https://leetcode-cn.com/problems/boats-to-save-people 英文原文You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at m…
原文链接: https://leetcode-cn.com/problems/projection-area-of-3d-shapes 英文原文You are given an n x n grid where we place some 1 x 1 x 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cubes placed on…
原文链接: https://leetcode-cn.com/problems/fair-candy-swap 英文原文Alice and Bob have a different total number of candies. You are given two integer arrays aliceSizes and bobSizes where aliceSizes[i] is the number of candies of the ith box of candy that Alic…
原文链接: https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-postorder-traversal 英文原文Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the …
原文链接: https://leetcode-cn.com/problems/find-and-replace-pattern 英文原文Given a list of strings words and a string pattern, return a list of words[i] that match pattern. You may return the answer in any order. A word matches the pattern if there exists a…
原文链接: https://leetcode-cn.com/problems/sum-of-subsequence-widths 英文原文The width of a sequence is the difference between the maximum and minimum elements in the sequence. Given an array of integers nums, return the sum of the widths of all the non-empt…
原文链接: https://leetcode-cn.com/problems/surface-area-of-3d-shapes 英文原文You are given an n x n grid where you have placed some 1 x 1 x 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of cell (i, j). After placing these cub…
原文链接: https://leetcode-cn.com/problems/groups-of-special-equivalent-strings 英文原文You are given an array of strings of the same length words. In one move, you can swap any two even indexed characters or any two odd indexed characters of a string words[…
原文链接: https://leetcode-cn.com/problems/bitwise-ors-of-subarrays 英文原文We have an array arr of non-negative integers. For every (contiguous) subarray sub = [arr[i], arr[i + 1], ..., arr[j]] (with i <= j), we take the bitwise OR of all the elements in su…
原文链接: https://leetcode-cn.com/problems/rle-iterator 英文原文We can use run-length encoding (i.e., RLE) to encode a sequence of integers. In a run-length encoded array of even length encoding (0-indexed), for all even i, encoding[i] tells us the number of…
原文链接: https://leetcode-cn.com/problems/numbers-at-most-n-given-digit-set 英文原文Given an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if digits = ['1','3','5']…
原文链接: https://leetcode-cn.com/problems/sort-array-by-parity 英文原文Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. Example 1: Input: …