Minimum Flips to Match Expected Binary Values in a Tree

Asked at UKG · Coding Questions · Difficulty: Medium

You are given an undirected tree with `tree_nodes` nodes, numbered from `0` to `tree_nodes - 1`, and rooted at node `0`. Each node initially has a binary value (0 or 1) given by the array `initial[]`, and an expected binary value given by the array `expected[]`.

Loading the problem…