Museum wing sizes
A museum stores its floor plan as `room_count` rooms numbered 0 to room_count minus 1, plus a set of doorways held in two parallel lists: doorway i joins room `door_from[i]` to room `door_to[i]`, and every doorway can be walked in both directions. A wing is a group of rooms that visitors can reach from one another by passing through doorways only. A room with no doorway at all is a wing of one, since a storage closet still counts. Return the size of every wing, sorted from largest to smallest. The plan may list the same doorway twice, and it may list a doorway leading from a room back into itself, neither of which joins anything new.
gallery_wing_sizes(room_count: int, door_from: list[int], door_to: list[int]) → list[int][6,[0,1,3],[1,2,4]]out[3,2,1][4,[],[]]out[1,1,1,1][5,[0,1,2,3],[1,2,3,4]]out[5]State 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.
[6,[0,1,3],[1,2,4]][3,2,1]not run yetsample[4,[],[]][1,1,1,1]not run yetsample[5,[0,1,2,3],[1,2,3,4]][5]not run yetsample