Not Equal On Tree
You are given a tree of $N$ nodes, and $2$ arrays of size $N$ - $A$ and $B$. You would like to ensure that $A_i \neq B_i$ for *every* $1 \leq i \leq N$. To achieve this, you can perform the following operation **exactly once**: 1. Pick a subset $S = \{X_1, X_2, \ldots, X_{|S|}\}$ of the nodes, such that the subgraph induced by $S$ is **connected**. - In other words, if $x, y \in S$, then eve
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start