Question
A sneaker resale app shows a pair's projected listing price for each of the next n days. You may buy the pair on one day and sell it on any later day, at most one buy and one sell. Return the largest profit you can lock in, or 0 if every buy-sell combination loses money (you can always choose not to trade). Example: prices [8, 3, 6, 4, 9] gives profit 6 — buy at 3, sell at 9.
max_flip_profit(prices: list[int]) → int[[8,3,6,4,9]]out6State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.