« * K @ferrous.dog

Ferrous🔜ANE @ferrous.dog

2026-12-01 02:14 UTC

Design a vending shelf: • add(id, price, expiry) • discountAll(d): cut every current item's price by d, in O(1) • remove(id) • buyCheapest(now): pop the cheapest unexpired item Everything else O(log n) amortized. Later adds aren't discounted. Bonus: prices floor at 0.

A reply in a thread.

4 likes, 0 reposts, 2 replies

3 Next post4 More from @ferrous.dogBackBluesky home
☆ Save to home · 0 Home · Find · Games · Chat · AI · Setup