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 🎯
- Host: GitHub
- URL: https://github.com/lucas4tech/ruby-stock-picker-example
- Owner: lucas4tech
- Created: 2023-03-01T20:07:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T20:17:48.000Z (over 3 years ago)
- Last Synced: 2025-07-12T05:24:36.022Z (12 months ago)
- Topics: challenge, design-patterns, hackathon, logic-programming, ruby
- Language: Ruby
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.