All Posts

Leetcode 621: Task Scheduler

Given a list of tasks and a number n, determine the minimum number of CPU intervals required to complete all tasks, respecting the constraint that the same task must be separated by at least n intervals.

Leetcode 658: Find K Closest Elements

Given a sorted integer array and two integers k and x, return the k closest integers to x in the array, sorted in ascending order. If two integers are equally close to x, the smaller integer should be preferred.

Leetcode 659: Split Array into Consecutive Subsequences

You are given a sorted integer array nums. Determine if it is possible to split nums into one or more subsequences such that each subsequence is a consecutive increasing sequence and each subsequence has a length of 3 or more.

Leetcode 692: Top K Frequent Words

Given a list of words and an integer k, return the k most frequent words in the list. The words should be sorted by their frequency in descending order. If two words have the same frequency, they should be sorted lexicographically.

Leetcode 703: Kth Largest Element in a Stream

You are tasked with implementing a class that helps track the kth highest score in a dynamic list of test scores. Each time a new score is submitted, you need to return the kth highest score in the list.

Leetcode 743: Network Delay Time

You are given a network of n nodes and a list of directed edges with travel times. You need to send a signal from a given node k. Return the minimum time it takes for all nodes to receive the signal, or return -1 if it is impossible.