Treasure Rooms Reachable from Any Room in DAG

Easykarat

Given a 2D array representing which room can see other rooms, and a set of integers representing treasure rooms, return all treasure room IDs that can be visited from any room.

Input:

  • A 2D arra...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: