leetcode

841. Keys and Rooms

Solution code

_N = rooms _
_E = keys _

Time complexity: O(N + E)

Space complexity: O(N)