[Java] | priorityQueue 0(nlogn)
\nclass Solution {\n    //easy solution by priorityQueue\n    public long maxTaxiEarnings(int n, int[][] rides) {\n        Arrays.sort(rides,(a,b)->a[0]-b[0]);\
```\nclass Solution {\n    //easy solution by priorityQueue\n    public long maxTaxiEarnings(int n, int[][] rides) {\n        Arrays.sort(rides,(a,b)->a[0]-b[0]);\n        \n        PriorityQueue<long[]>pq=new PriorityQueue<>((a,b)->Long.compare(a[0],b[0]));\n        long maxf=0;\n        \n        for(int i=0;i<rides.length;i++){\n            while(pq.size() > 0 && pq.peek()[0] <= rides[i][0])\n                maxf=Math.max(maxf,pq.remove()[1]);\n            \n            pq.add(new long[]{rides[i][1],rides[i][1]-rides[i][0]+rides[i][2]+maxf});\n        }\n       long sum=0;\n        \n        while(pq.size() > 0)\n            sum=Math.max(sum,pq.remove()[1]);\n        \n        return sum;\n        \n    }\n}\n```
[]