easyDSA

Best Time to Buy and Sell Stock

You are given an array where each element is price of a stock on a day. Find maximum profit by choosing a single buy and sell day.
Ensure function signatures match starter code to run test cases.
index.js
Loading...

Test Case #1

Input: [7,1,5,3,6,4]

Expected: 5

Solve Best Time to Buy and Sell Stock | Algorithmic Interview Drill