Count panel shapes
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.
distinct_wiring_shapes(panels: list[list[int]]) → int[[[1,0,2],[0,2,1]]]out1[[[1,2,0],[1,0,2]]]out2[[[0,1,2],[2,0,1]]]out2State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
[[[1,0,2],[0,2,1]]]1not run yetsample[[[1,2,0],[1,0,2]]]2not run yetsample[[[0,1,2],[2,0,1]]]2not run yetsample