2830. Maximize the Profit as the Salesman
You are given an integer
nrepresenting the number of houses on a number line, numbered from0ton - 1.Additionally, you are given a 2D integer array
offerswhereoffers[i] = [starti, endi, goldi], indicating thatithbuyer wants to buy all the houses fromstartitoendiforgoldiamount of gold.As a salesman, your goal is to maximize your earnings by strategically selecting and selling houses to buyers.
Return the maximum amount of gold you can earn.
Note that different buyers can’t buy the same house, and some houses may remain unsold.
1 | class Solution { |