Museum wing sizes
Your task
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.
Examples
gallery_wing_sizes(room_count: int, door_from: list[int], door_to: list[int]) -> list[int]Example 1
Input
gallery_wing_sizes(6, [0, 1, 3], [1, 2, 4])Output
[3, 2, 1]Example 2
Input
gallery_wing_sizes(4, [], [])Output
[1, 1, 1, 1]Example 3
Input
gallery_wing_sizes(5, [0, 1, 2, 3], [1, 2, 3, 4])Output
[5]