Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 301 Bytes

15-MaxStockProfit.md

File metadata and controls

12 lines (8 loc) · 301 Bytes

Max stock profit

The problem

Write a function f(N) that accepts an array of prices and returns the max possible profit of the day

  • If no profit is possible, return -1
  • treat 0 as any other max profit value

Concepts

Notes

  • can be solved with nested loops, with O(n^2) or O(n), with