You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import { PriorityQueue } from '@datastructures-js/priority-queue';
// First Approach - Heap method with min priority queueing nums and checking if the front number is lesser than k, if so do the operation and continue. (127ms - Beats 100.00%)
function minOperations(nums: number[], k: number): number {
// Could not type as MinPriorityQueue because of LeetCode lib version limitation
const pqNums = new PriorityQueue({ compare: (a, b) => a - b });