Back to problems

Implement Game Physics and Block Mining

Object-Oriented Programming · Coinbase · Medium

Task A: One-Tick Bird Update The important detail is ordering: jump input is applied first, then gravity is added, then position is updated. The bird remains alive when the new position is exactly 0 or exactly height. Task B: Dependency-Aware Greedy Block Builder Time Complexity Let n be the number of transactions and e be the number of dependency edges. Cycle detection takes O(n + e). Memoized ancestor-closure construction is O(n^3) in the worst case because set operations…

Checking your access…