/*
Writing coding interview questions hasn't made me rich. Maybe trading Apple stocks will.
Suppose we could access yesterday's stock prices as a list, where:

The indices are the time in minutes past trade opening time, which was 9:30am local time.
The values are the price in dollars of Apple stock at that time.
So if the stock cost $500 at 10:30am, stock_prices_yesterday[60] = 500.

Write an efficient function that takes stock_prices_yesterday and returns the best profit I could have made from 1 purchase and 1 sale of 1 Apple stock yesterday.

For example:

  stock_prices_yesterday = [10, 7, 5, 8, 11, 9]

get_max_profit(stock_prices_yesterday)
# returns 6 (buying for $5 and selling for $11)

No "shorting"—you must buy before you sell. You may not buy and sell in the same time step (at least 1 minute must pass).
/*

@@ -818,11 +818,423 @@
  pass).%0A
-/
 *
+/%0A%0Avar stock_prices_yesterday = %5B10,7,5,8,11,9%5D;%0Avar get_max_profit = function(stockArray)%7B%0A  var bestPrice = 0;%0A  for (var i = 0; i %3C stockArray.length; i++) %7B%0A    for (var j = i+1; j %3C stockArray.length; j++) %7B%0A      if (stockArray%5Bj%5D - stockArray%5Bi%5D %3E bestPrice) %7B%0A        bestPrice = stockArray%5Bj%5D - stockArray%5Bi%5D;%0A      %7D%0A    %7D%0A  %7D%0A  return bestPrice;%0A%7D%0A%0A%0Aconsole.log(get_max_profit(stock_prices_yesterday));
 %0A

question 1 in javascript