Maximum profit from single stock buy/sell and minimum gap pair
Filed under PayU
The question
Given an array of stock prices for a day, find the maximum profit by buying and selling once, and then find the pair with the minimum gap between buying and selling.
No write-up yet. Related questions below have one.
Related PayU questions
Collected from public candidate posts and coding forums. Updated Nov 2026.