📊 Nearly Sorted Array (Each element at most K positions from
sorted)
💡 In a nearly sorted array, each element is at most K positions
away from its sorted position. Using a min-heap of size K+1, we can
sort it in O(n log K) time.
Min-Heap (Window)