All Posts

Leetcode 2349: Design a Number Container System

Design a number container system that allows inserting or replacing a number at a specific index and finding the smallest index for a given number.

Leetcode 2353: Design a Food Rating System

Design a food rating system that allows modification of food ratings and can return the highest-rated food item for a given cuisine. In case of a tie, the lexicographically smallest food item should be returned.

Leetcode 2357: Make Array Zero by Subtracting Equal Amounts

You are given a non-negative integer array nums. In each operation, you must:

  • Choose a positive integer x that is less than or equal to the smallest non-zero element in nums.
  • Subtract x from every positive element in nums.

Return the minimum number of operations to make every element in nums equal to 0.

Leetcode 2406: Divide Intervals Into Minimum Number of Groups

You are given a 2D array of intervals, where each interval is represented as a pair of integers [left, right], denoting an inclusive range. Your task is to divide these intervals into the minimum number of groups such that no two intervals within the same group overlap. Two intervals overlap if there is at least one common number between them.

Leetcode 2424: Longest Uploaded Prefix

You are given a stream of n distinct videos, each represented by a unique number from 1 to n. You need to design a data structure that tracks the longest prefix of uploaded videos at any point in time. A prefix is considered uploaded if all videos from 1 to i (inclusive) have been uploaded to the server.

Leetcode 2456: Most Popular Video Creator

You are given three arrays: ‘creators’, ‘ids’, and ‘views’. Each index i corresponds to a video created by the creator ‘creators[i]’, with an id ‘ids[i]’, and a number of views ‘views[i]’. The task is to find the most popular creators based on the sum of views of all their videos and identify the id of their most viewed video. If multiple creators have the same popularity, return all of them. For each creator, if they have multiple videos with the highest view count, return the lexicographically smallest id of their most viewed video.