Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 372 Bytes

README.md

File metadata and controls

16 lines (10 loc) · 372 Bytes

Maximum Profit From Stocks

This problem was recently asked by Apple.

Description

You are given an array. Each element represents the price of a stock on that particular day.

Calculate and return the maximum profit you can make from buying and selling that stock only once.

Example

Input: (9, 11, 8, 5, 7, 10)
Output: 5 (Buy on "5" and sell on "10")