Treasure Rooms Reachable from Any Room in DAG

Asked at Karat · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

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.

Loading the problem…