Best approach for beginners using Java (Priority Queue)
IntuitionTo maximize the total reward, we need to selectively swap k rewards from reward2 to reward1. The best swaps are determined by the largest differences r
# Intuition
To maximize the total reward, we need to selectively swap `k` rewards from `reward2` to `reward1`. The best swaps are determined by the largest differences `reward1[i] - reward2[i]`.

# Approach
1. Compute the initial total by summing all values from `reward2` (assuming all rewards are given to the second mouse).
2. Use a max-heap (priority queue) to store the difference `reward1[i] - reward2[i]`, which tells us how much more we gain by giving the reward to the first mouse instead of the second.
3. Extract the top `k` elements from the heap and add them to `total`, as they represent the highest gains from switching.
4. Return the final computed `total`.

# Complexity
- Time complexity: $$O(n)$$ since inserting into and extracting from a heap of size `n` runs in $$O(n)$$ overall.
- Space complexity: $$O(n)$$ for storing the heap.


# Code
```java []
class Solution {
    public int miceAndCheese(int[] reward1, int[] reward2, int k) {
        int total = 0;
        for (int num : reward2) {
            total += num;
        }

        PriorityQueue<Integer> maxHeap = new PriorityQueue<>((a, b) -> b - a);
        for (int i = 0; i < reward1.length; i++) {
            int diff = reward1[i] - reward2[i];
            maxHeap.offer(diff);
        }

        for (int i = 0; i < k; i++) {
            total += maxHeap.poll();
        }
        return total;
    }
}

```
['Java']