Complete the code to create a max heap from the input array.
var maxHeap = new PriorityQueue<int, int>(array.Length, Comparer<int>.[1]());The max heap is created by using a comparer that reverses the default order, so the largest element is at the top.
Complete the code to add all elements from the array into the max heap.
foreach (var num in array) maxHeap.[1](num, num);
PriorityQueue in C# uses Enqueue to add elements with their priority.
Fix the error in the code to remove the largest element from the max heap.
int largest = maxHeap.[1]();PriorityQueue in C# uses Dequeue to remove and return the element with highest priority.
Fill both blanks to remove the top element k-1 times from the max heap.
for (int i = 0; i < [1] - 1; i++) { maxHeap.[2](); }
We remove the top element k-1 times using Dequeue to reach the kth largest element.
Fill all three blanks to return the kth largest element from the max heap after removals.
int kthLargest = maxHeap.[1](); return [2];
After removing k-1 largest elements, Dequeue returns the kth largest, which we return.
