全站内容
easy
598. Range Addition II
#Problem You are given an m x n matrix M initialized with all 0’s and an array of operations ops, where ops[i] = [aᵢ, bᵢ] means M[x][y] should be incremented by one for all 0 <= x < aᵢ and 0 <= y < bᵢ. Count and return the number of maximum …
541. Reverse String II
#Problem Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string. If there are fewer than k characters left, reverse all of them. If there are less than 2k but greater …
344. Reverse String
#Problem Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. https://leetcode.cn/problems/reverse-string/ Example 1: …
350. Intersection of Two Arrays II
#Problem Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order. …
349. Intersection of Two Arrays
#Problem Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. https://leetcode.cn/problems/intersection-of-two-arrays/ Example …
219. Contains Duplicate II
#Problem Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i - j) <= k. https://leetcode.cn/problems/contains-duplicate-ii/ Example 1: …
118. Pascal’s Triangle
#Problem Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: https://leetcode.cn/problems/pascals-triangle/ pascalExample 1: …
119. Pascal's Triangle II
#Problem Given an integer rowIndex, return the rowIndexᵗʰ (0-indexed) row of the Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: …
2239. Find Closest Number to Zero
#Problem Given an integer array nums of size n, return the number with the value closest to 0 in nums. If there are multiple answers, return the number with the largest value. https://leetcode.cn/problems/find-closest-number-to-zero/ …
3095. Shortest Subarray With OR at Least K I
#Problem You are given an array nums of non-negative integers and an integer k. An array is called special if the bitwise OR of all of its elements is at least k. Return the length of the shortest special non-empty subarray of nums, or …