TikTok Interview Question

Algorithm problems. Heap; dynamic programming.