MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / compare

Method compare

RangeSumOfSortedSubarraySums.java:6–8  ·  view source on GitHub ↗
(int a[], int b[])

Source from the content-addressed store, hash-verified

4 public int rangeSum(int[] nums, int n, int left, int right) {
5 PriorityQueue<int[]> pq = new PriorityQueue<>(new Comparator<int[]>(){
6 public int compare(int a[], int b[]){
7 return a[0] - b[0];
8 }
9 });
10 for(int i=0;i<n;i++){
11 pq.offer(new int[]{nums[i],i});

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected