Shortest Path with Alternating Colors

Implement solve for Shortest Path with Alternating Colors. Return the required output for the provided arguments.

Examples
Input: [3,[[0,1],[1,2]],[]]
Output: [0,1,-1]
Hints

Shortest Path with Alternating Colors

Implement `solve` for **Shortest Path with Alternating Colors**. Return the required output for the provided arguments.