Search⌘ K
AI Features

Solution: Collect Coins in a Tree

Solution: Collect Coins in a Tree asks you to start anywhere in an undirected tree, collect every coin from within two edges, and return to your start with minimum total movement.

Statement

You are given an undirected, unrooted tree with n nodes indexed from 00 to n−1n - 1. The tree structure is defined by a 22D integer array edges of length n ...