Count panel shapes
Your task
A patch panel has n ports, and its wiring sends whatever arrives at port i out through port wiring[i]. Every panel lists each port exactly once, so signals never merge and none is lost. Two panels have the same shape when renumbering the ports of one, one consistent renumbering applied everywhere, reproduces the other panel's wiring exactly. Two panels can share the same shape while agreeing on no single entry, and panels with different port counts never share a shape. Given the panels, return how many distinct shapes are present among them. Return 0 when no panels are given.
Examples
distinct_wiring_shapes(panels: list[list[int]]) -> intExample 1
Input
distinct_wiring_shapes([[1, 0, 2], [0, 2, 1]])Output
1Example 2
Input
distinct_wiring_shapes([[1, 2, 0], [1, 0, 2]])Output
2Example 3
Input
distinct_wiring_shapes([[0, 1, 2], [2, 0, 1]])Output
2