Easy Kotlin DP solution
\nfun maxTaxiEarnings(n: Int, rides: Array<IntArray>): Long {\n        rides.sortBy{it[1]}\n        \n        val dp = Array(n+1){0.toLong()}\n        var index
```\nfun maxTaxiEarnings(n: Int, rides: Array<IntArray>): Long {\n        rides.sortBy{it[1]}\n        \n        val dp = Array(n+1){0.toLong()}\n        var index = 0\n        for (i in 1..n) {\n            dp[i] = dp[i-1]\n            \n            while (index < rides.count() && rides[index][1] <= i) {\n                dp[i] = Math.max(dp[i], dp[rides[index][0]] + (rides[index][1] - rides[index][0] + rides[index][2]))\n                index++\n            }\n        }\n        \n        return dp[n]\n    }\n```
[]