全站内容
easy
1656. Design an Ordered Stream
#Problem There is a stream of n (idKey, value) pairs arriving in an arbitrary order, where idKey is an integer between 1 and n and value is a string. No two pairs have the same id. Design a stream that returns the values in increasing order …
2506. Count Pairs Of Similar Strings
#Problem You are given a 0-indexed string array words. Two strings are similar if they consist of the same characters. For example, "abca" and "cba" are similar since both consist of characters 'a', 'b', and 'c'. However, "abacba" and …
2595. Number of Even and Odd Bits
#Problem You are given a positive integer n. Let even denote the number of even indices in the binary representation of n with value 1. Let odd denote the number of odd indices in the binary representation of n with value 1. Note that bits …
1287. Element Appearing More Than 25% In Sorted Array
#Problem Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer. …
1299. Replace Elements with Greatest Element on Right Side
#Problem Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. After doing so, return the array. …
1742. Maximum Number of Balls in a Box
#Problem You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory …
3174. Clear Digits
#Problem You are given a string s. Your task is to remove all digits by doing this operation repeatedly: Delete the first digit and the closest non-digit character to its left. Return the resulting string after removing all digits. …
26. Remove Duplicates from Sorted Array
#Problem Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. Then return the number of …
59. Spiral Matrix II
#Problem Given a positive integer n, generate an n x n matrix filled with elements from 1 to n² in spiral order. https://leetcode.cn/problems/spiral-matrix-ii/ Example 1: case1Input: n = 3 Output: [[1,2,3],[8,9,4],[7,6,5]] Example 2: Input: …
47. Permutations II
#Problem Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. https://leetcode.cn/problems/permutations-ii/ Example 1: Input: nums = [1,1,2] Output: json 复制 [[1,1,2], …