Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def eddington(rides)
- eds = []
- rides.each{ |ride|
- if (rides.select{ |i| i==ride}.length) >= ride
- eds.push ride
- end
- }
- eds.sort[-1]
- end
- rides = [7, 7, 7, 3, 3, 3, 14, 5, 2, 2]
- puts eddington(rides)
Add Comment
Please, Sign In to add comment