re: Write better code: Day 1 - Apple Stock Prices VIEW POST

VIEW FULL DISCUSSION
 

In ruby

possible_trades = stock_prices.combination(2).to_a
max_trade_index = possible_trades.map { |x,y| y-x }.each_with_index.max[1]
return possible_trades[max_trade_index]
code of conduct - report abuse