Easy 2 understand unique short TreeMap solution!
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public 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 currProfit = dp.floorEntry(ride[0]).getValue() + (ride[1]-ride[0]+ride[2]);\n            if(currProfit>dp.lastEntry().getValue()){\n                dp.put(ride[1], currProfit);\n            }\n        }\n        return dp.lastEntry().getValue();\n    }\n}\n```
['Java']