You are given an undirected tree with edges of length edges[i] = [a_i, b_i] denotes an edge connecting nodes a_i and b_i.
You are also given two binary strings start and target, both of length
In one operation, you can toggle an edge with index a_i and b_i from '$0$' to '$1$' or from '$1$' to '$0$'.
Return a list containing the indices of the edges that must be toggled to transform start into target. If there is no valid sequence of toggles, return [-1].
Constraints:
start.length target.length
edges.length
edges[i] = [a_i, b_i]
start[i] is either '$0$' or '$1$'.
target[i] is either '$0$' or '$1$'.
The input is generated such that edges represents a valid tree.
You are given an undirected tree with edges of length edges[i] = [a_i, b_i] denotes an edge connecting nodes a_i and b_i.
You are also given two binary strings start and target, both of length
In one operation, you can toggle an edge with index a_i and b_i from '$0$' to '$1$' or from '$1$' to '$0$'.
Return a list containing the indices of the edges that must be toggled to transform start into target. If there is no valid sequence of toggles, return [-1].
Constraints:
start.length target.length
edges.length
edges[i] = [a_i, b_i]
start[i] is either '$0$' or '$1$'.
target[i] is either '$0$' or '$1$'.
The input is generated such that edges represents a valid tree.