Java DP 10 lines of clean code, beat 65%
\npublic long maxTaxiEarnings(int n, int[][] rides) {\n        Arrays.sort(rides, (a, b) -> (a[1] - b[1]));\n        TreeMap<Integer, Long> dp = new TreeMap<>()
```\npublic long maxTaxiEarnings(int n, int[][] rides) {\n        Arrays.sort(rides, (a, b) -> (a[1] - b[1]));\n        TreeMap<Integer, Long> dp = new TreeMap<>();\n        dp.put(0, 0L);\n        for (int[] ride : rides) {\n            long currEarning = ride[1] - ride[0] + ride[2] + dp.floorEntry(ride[0]).getValue();\n            if (currEarning > dp.lastEntry().getValue()) {\n                dp.put(ride[1], currEarning);\n            }  \n        }\n        return dp.lastEntry().getValue();\n    }\n```
['Dynamic Programming', 'Java']