What is DP again? Coding the answer in Swift, does that offend you? Sorry.
DP: Dynamic programming A method for solving problems by breaking them down into similar subproblems.
LeetCode 121. Best time to buy and sell stock
For an array of prices, the iᵗʰ element is the price of a stock on day i. How can…