β back to unit
Challenge
# puzzle gauntlet advanced
The Amusement Park Day
One glorious day: a pocket of coins, a closing time, and the rides in the order you'll walk past them. Live it! π’
You get your coins and minutes, then the rides as name:cost:time. Walking the row in order: ride anything you can afford in BOTH coins and remaining minutes (pay and spend the time); otherwise walk on. Print rides <count> coins <left> minutes <left>.
Example:
Input: coins = 20, minutes = 60, rides = ["coaster:8:25", "teacups:3:10", "drop:10:20", "wheel:5:15"]
Output: rides 3 coins 4 minutes 10
coaster fits (12 coins, 35 min left), teacups fits (9 coins, 25 min left), drop is skipped since only 9 coins remain but it costs 10, then wheel fits (4 coins, 10 min left) β 3 rides total.
π‘ need a hint?
pg-amusement-park.pyπ given lines are locked β write your code in between
loading...