Simple DSA Question: Given an array of stock prices, find the best day to buy and sell to maximize profit.
Approach: Track minimum price so far and calculate max profit at each step.
Interview questions [1]
Question 1
Given an array of stock prices, find the best day to buy and sell to maximize profit.
Approach: Track minimum price so far and calculate max profit at each step.