← Questions

K-th largest value over the last N seconds of a stream

0
xAICodingLast asked Jan 2026

Start with finding the k-th largest element of an array. Then values arrive with timestamps and queries ask for the k-th largest among values from the last N seconds; design a structure that handles inserts, expiry and queries efficiently.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding