there n room label 0 n 1 room lock room 0 your goal visit room however enter locked room have keywhen visit room find set distinct key each key number denoting room unlock unlock roomsGiven array room roomsi set key obtain visit room return true visit room false Example 1input room 123output trueexplanation we visit room 0 pick key 1we visit room 1 pick key 2we visit room 2 pick key 3we visit room 3since able visit room return trueExample 2input room 1330120output falseexplanation we enter room number 2 key unlock room Constraintsn roomslength2 n 10000 roomsilength 10001 sumroomsilength 30000 roomsij nAll value roomsi unique