An open API service indexing awesome lists of open source software.

https://github.com/lucas4tech/ruby-stock-picker-example

Building an algorithm to see the best day to buy and the best day to sell using Ruby 🎯
https://github.com/lucas4tech/ruby-stock-picker-example

challenge design-patterns hackathon logic-programming ruby

Last synced: 10 months ago
JSON representation

Building an algorithm to see the best day to buy and the best day to sell using Ruby 🎯

Awesome Lists containing this project

README

          

# Stock Picker

Implement a method #stock_picker that takes in an array of stock prices, one for each hypothetical day. It should return a pair of days representing the best day to buy and the best day to sell. Days start at 0.

```
stock_picker([17,3,6,9,15,8,6,1,10])
=> [1,4]
```
#### Quick Tips:
* You need to buy before you can sell
* Pay attention to edge cases like when the lowest day is the last day or the highest day is the first day.