Kth Largest Element in a Stream
Design a class to find the kth largest element in a stream. Think about: How to efficiently maintain the kth largest? Hint: Use a min-heap of size k. Example: KthLargest(3, [4, 5, 8, 2]) add(3) → 4 add(5) → 5 add(10) → 5
Kth Largest Element in a Stream is about always pulling the next best option efficiently as the data changes. It's a great warm-up that builds priority-based reasoning without a ton of moving parts. If your heap represents best candidates right now, the rest falls into place.

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.