there n point road drive taxi the n point road label 1 n direction go want drive point 1 point n money pick passenger you change direction taxithe passenger represent 0indexed 2D integer array ride ridesi starti endi tipi denote ith passenger request ride point starti point endi willing tipi dollar tipfor passenger pick earn endi starti tipi dollar you drive passenger timeGiven n ride return maximum number dollar earn pick passenger optimallynote you drop passenger pick different passenger point Example 1input n 5 ride 254151output 7explanation we pick passenger 0 earn 5 2 4 7 dollarsexample 2input n 20 ride 161310210123111221215213181output 20explanation we pick follow passenger drive passenger 1 point 3 point 10 profit 10 3 2 9 dollar drive passenger 2 point 10 point 12 profit 12 10 3 5 dollar drive passenger 5 point 13 point 18 profit 18 13 1 6 dollarsWe earn 9 5 6 20 dollar total Constraints1 n 1051 rideslength 3 104ridesilength 31 starti endi n1 tipi 105