Back to QuestionsPractice with This Question
Find K Closest Elements (Heaps)
148.1K views•Asked at Meta•
Medium
Question Explain
Given a sorted array, a target value $x$, and an integer $k$, find the $k$ closest elements to $x$ in the array. Use a Max-Heap to maintain the $k$ closest elements.
Start Trying This Question Simulation
Practice answering orally or with text to get instant AI feedback.