All Posts

Leetcode 1834: Single-Threaded CPU

You are given a list of tasks, where each task is represented by a pair of integers: [enqueueTime, processingTime]. The task can only be processed once its enqueueTime has passed. Your goal is to find the order in which tasks are processed by a single-threaded CPU that follows a specific processing strategy.

Leetcode 1838: Frequency of the Most Frequent Element

You are given an integer array nums and an integer k. In one operation, you can increment any element of the array by 1. Your task is to return the maximum possible frequency of any element after performing at most k operations.

Leetcode 1839: Longest Substring Of All Vowels in Order

A string is considered beautiful if it satisfies the following conditions: each of the five vowels (‘a’, ’e’, ‘i’, ‘o’, ‘u’) must appear at least once, and the characters must appear in alphabetical order. Given a string word consisting of English vowels, return the length of the longest beautiful substring of word. If no such substring exists, return 0.

Leetcode 1845: Seat Reservation Manager

Design a system to manage the reservation state of n seats numbered from 1 to n. Implement the SeatManager class to handle reserving and unreserving seats. The class should be able to return the smallest available seat when reserved, and make seats available again when unreserved.

Leetcode 1846: Maximum Element After Decreasing and Rearranging

You are given an array of positive integers arr. Perform a series of operations (possibly none) on arr to make it satisfy the following conditions: The value of the first element in arr must be 1, and the absolute difference between any two adjacent elements must be less than or equal to 1. You can decrease the value of any element and rearrange the elements in any order. Return the maximum possible value of an element in arr after performing the operations.

Leetcode 1849: Splitting a String Into Descending Consecutive Values

Given a string s consisting of digits, check if it is possible to split it into two or more non-empty substrings such that the numerical values of the substrings are in strictly descending order and the difference between the values of adjacent substrings is exactly 1.