K Most Frequent Strings
Medium
Find the k most frequently occurring strings in an array, and return them sorted by frequency in descending order. If two strings have the same frequency, sort them in lexicographical order.
Example:
Input: strs = ['go', 'coding', 'byte', 'byte', 'go', 'interview', 'go'], k = 2
Output: ['go', 'byte']
Explanation: The strings “go” and “byte” appear the most frequently, with frequencies of 3 and 2, respectively.
Constraints:
k ≤ n, wherendenotes the length of the array.
Combine Sorted Linked Lists
Medium
Given k singly linked lists, each sorted in ascending order, combine them into one sorted linked list.
Example:

Median of an Integer Stream
Hard
Design a data structure that supports adding integers from a data stream and retrieving the median of all elements received at any point.
add(num: int) -> None: adds an integer to the data structure.get_median() -> float: returns the median of all integers so far.
Example:
Input: [add(3), add(6), get_median(), add(1), get_median()]
Output: [4.5, 3.0]
Explanation:
add(3) # data structure contains [3] when sorted
add(6) # data structure contains [3, 6] when sorted
get_median() # median is (3 + 6) / 2 = 4.5
add(1) # data structure contains [1, 3, 6] when sorted
get_median() # median is 3.0
Constraints:
- At least one value will have been added before
get_medianis called.
Sort a K-Sorted Array
Medium
Given an integer array where each element is at most k positions away from its sorted position, sort the array in a non-decreasing order.
Example:
Input: nums = [5, 1, 9, 4, 7, 10], k = 2
Output: [1, 4, 5, 7, 9, 10]