Lucid | OA | Collect The Coins: Optimal Tree Trimming
Question · Posted Apr 2026
Problem Statement: Collect The Coins The Scenario: Alex is playing a game in "Hackerland," which is represented as a tree of n vertices indexed from 0 to n−1. An array coins indicates the presence of coins: coins[i] = 1 means vertex i has a coin; otherwise, it is empty. The Objective: Alex needs to travel along the tree edges to collect all the coins and return to his starting position. Rules of Collection: From any vertex x, Alex can automatically ...
The full answer & interview discussion are available to premium members.
Log in Create a free account