Maximize Profit with Stock Transactions

Asked at Zillow · Coding Questions · Difficulty: Easy

You are given the price of one stock on each of several days. You may complete at most one transaction: buy one share on one day and sell it on a later day. Find the largest profit you can make. If no transaction makes a profit, the answer is `0`.

Loading the problem…