Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Solution {
public long maximumScore(int[] nums, String s) {
long sum = 0;
PriorityQueue<Integer> pq = new PriorityQueue<>((a, b) -> b - a);
PriorityQueue<Integer> pq = new PriorityQueue<>((a, b) -> Integer.compare(b, a));
for (int i = 0; i < nums.length; i++) {
if (s.charAt(i) == '1') {
if (pq.isEmpty() || pq.peek() <= nums[i]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public EventManager(int[][] events) {
new PriorityQueue<>(
(a, b) -> {
if (a.priority != b.priority) {
return b.priority - a.priority;
return Integer.compare(b.priority, a.priority);
}
return a.id - b.id;
return Integer.compare(a.id, b.id);
});
for (int[] event : events) {
pq.add(new Pair(event[0], event[1]));
Expand Down