Dependency Reachability Queries - Coding problem | OneNoughtOne