原文链接: https://leetcode-cn.com/problems/arithmetic-subarrays 英文原文A sequence of numbers is called arithmetic if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence s is …
分类详情
中等 分类
原文链接: https://leetcode-cn.com/problems/path-with-minimum-effort 英文原文You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are si…
原文链接: https://leetcode-cn.com/problems/minimum-deletions-to-make-string-balanced 英文原文You are given a string s consisting only of characters 'a' and 'b'. You can delete any number of characters in s to make s balanced. s is balanced if there is no…
原文链接: https://leetcode-cn.com/problems/minimum-jumps-to-reach-home 英文原文A certain bug's home is on the x-axis at position x. Help them get there from position 0. The bug jumps according to the following rules: It can jump exactly a positions forward (…
原文链接: https://leetcode-cn.com/problems/furthest-building-you-can-reach 英文原文You are given an integer array heights representing the heights of buildings, some bricks, and some ladders. You start your journey from building 0 and move to the next buildi…
原文链接: https://leetcode-cn.com/problems/merge-in-between-linked-lists 英文原文You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1's nodes from the ath node to the bth node, and put list2 in their place. The blue edg…
原文链接: https://leetcode-cn.com/problems/design-front-middle-back-queue 英文原文Design a queue that supports push and pop operations in the front, middle, and back. Implement the FrontMiddleBack class: FrontMiddleBack() Initializes the queue. void pushFron…
原文链接: https://leetcode-cn.com/problems/minimum-deletions-to-make-character-frequencies-unique 英文原文A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of cha…
原文链接: https://leetcode-cn.com/problems/sell-diminishing-valued-colored-balls 英文原文You have an inventory of different colored balls, and there is a customer that wants orders balls of any color. The customer weirdly values the colored balls. Each color…
原文链接: https://leetcode-cn.com/problems/minimum-operations-to-reduce-x-to-zero 英文原文You are given an integer array nums and an integer x. In one operation, you can either remove the leftmost or the rightmost element from the array nums and subtract its…
原文链接: https://leetcode-cn.com/problems/determine-if-two-strings-are-close 英文原文Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. <ul> <li>For example, <…
原文链接: https://leetcode-cn.com/problems/smallest-string-with-a-given-numeric-value 英文原文The numeric value of a lowercase character is defined as its position (1-indexed) in the alphabet, so the numeric value of a is 1, the numeric value of b is 2, the …
原文链接: https://leetcode-cn.com/problems/splitting-a-string-into-descending-consecutive-values 英文原文You are given a string s that consists of only digits. Check if we can split s into two or more non-empty substrings such that the numerical values of th…
原文链接: https://leetcode-cn.com/problems/minimum-adjacent-swaps-to-reach-the-kth-smallest-number 英文原文You are given a string num, representing a large integer, and an integer k. We call some integer wonderful if it is a permutation of the digits in num …
原文链接: https://leetcode-cn.com/problems/maximum-distance-between-a-pair-of-values 英文原文You are given two non-increasing 0-indexed integer arrays nums1 and nums2. A pair of indices (i, j), where 0 <= i < nums1.length and 0 <= j < nums2.lengt…
原文链接: https://leetcode-cn.com/problems/maximum-subarray-min-product 英文原文The min-product of an array is equal to the minimum value in the array multiplied by the array's sum. For example, the array [3,2,5] (minimum value is 2) has a min-product of 2 *…
原文链接: https://leetcode-cn.com/problems/minimize-maximum-pair-sum-in-array 英文原文The pair sum of a pair (a,b) is equal to a + b. The maximum pair sum is the largest pair sum in a list of pairs. For example, if we have pairs (1,5), (2,3), and (4,4), the …
原文链接: https://leetcode-cn.com/problems/minimum-number-of-swaps-to-make-the-binary-string-alternating 英文原文Given a binary string s, return the minimum number of character swaps to make it alternating, or -1 if it is impossible. The string is called alt…
原文链接: https://leetcode-cn.com/problems/finding-pairs-with-a-certain-sum 英文原文You are given two integer arrays nums1 and nums2. You are tasked to implement a data structure that supports queries of two types: Add a positive integer to an element of a g…
原文链接: https://leetcode-cn.com/problems/minimum-speed-to-arrive-on-time 英文原文You are given a floating-point number hour, representing the amount of time you have to reach the office. To commute to the office, you must take n trains in sequential order.…
原文链接: https://leetcode-cn.com/problems/find-the-student-that-will-replace-the-chalk 英文原文There are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the student number 0, then the student number…
原文链接: https://leetcode-cn.com/problems/maximum-value-after-insertion 英文原文You are given a very large integer n, represented as a string, and an integer digit x. The digits in n and the digit x are in the inclusive range [1, 9], and n may represe…
原文链接: https://leetcode-cn.com/problems/process-tasks-using-servers 英文原文You are given two 0-indexed integer arrays servers and tasks of lengths n and m respectively. servers[i] is the weight of the ith server, and tasks[j] is the…
原文链接: https://leetcode-cn.com/problems/reduction-operations-to-make-the-array-elements-equal 英文原文Given an integer array nums, your goal is to make all elements in nums equal. To complete one operation, follow these steps: Find the largest value in nu…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-flips-to-make-the-binary-string-alternating 英文原文You are given a binary string s. You are allowed to perform two types of operations on the string in any sequence: Type-1: Remove the character a…
原文链接: https://leetcode-cn.com/problems/remove-all-occurrences-of-a-substring 英文原文Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed: Find the leftmost occurrence of the substring…
原文链接: https://leetcode-cn.com/problems/maximum-alternating-subsequence-sum 英文原文The alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For example, the alternating s…
原文链接: https://leetcode-cn.com/problems/merge-triplets-to-form-target-triplet 英文原文A triplet is an array of three integers. You are given a 2D integer array triplets, where triplets[i] = [ai, bi, ci] describes the ith triplet. You are also given an int…
原文链接: https://leetcode-cn.com/problems/maximum-number-of-removable-characters 英文原文You are given two strings s and p where p is a subsequence of s. You are also given a distinct 0-indexed integer array removable containing a subset of indices of s (s …
原文链接: https://leetcode-cn.com/problems/egg-drop-with-2-eggs-and-n-floors 英文原文You are given two identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= f <= n such that any eg…