I think It is a Greedy approach


#1

Why because at any position, we have two options to buy or sell. if the previous buy > current cost then we will buy previous buy = current cost or else find profit = current - previous buy. in the end, we get max profit from this profit.I think it is greedy