+1 714-215-3097

(Solved) : Write Function Input List Positive Integers Representing Value Stock Consecutive Days Out Q35625844

Write a function with…

  • Input: a list of positive integers representing the value of astock on consecutive days
  • Output: the maximum profit obtainable from buying and sellingthe stock once


If the input were [2,1,5,3,7,10,9] then the output would be

  • Buy at 1
  • Sell at 10
  • Total gain 9

Leave a Reply

Your email address will not be published. Required fields are marked *