Skip to content

Program 2: Maximum Stock Profit #3

Description

@github-actions

Program 2: Maximum Stock Profit

DefineWrite a program that finds the best days to buy and sell stocks to maximize profit, given an array of stock prices. Return the maximum profit that can be made. If no profit can be made, return -1.

samples

Input Output
[100,180,260,310,40,535,695] Buy on day 5 at price 40
Sell on day 7 at price 695
Max profit: 655

Tasks

  • Develop program using your choice of programming language
  • Create test script covering all scenarios (min 5 test cases)
  • Add comments/documentation to the code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions