Stock Max Profit (Single or Multiple Transactions)
Problem
Given a sequence of stock prices, solve one of two variants (the interviewer will specify):
Variant A: Single transaction
You may complete at most one buy and one sell (buy must ha...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
