L3HARRIS TECHNOLOGIES | Online Interview Question | Off-Campus OA(2023)

Question · Posted Jun 2026

Problem: Reachable Nodes With Restrictions Problem Statement You are given: An undirected tree with n nodes numbered from 0 to n-1. An array edges representing the tree. An array restricted containing nodes that cannot be visited. Starting from node 0, return the number of nodes that can be reached without visiting any restricted node. Example Input n = 7 edges = [[0,1],[1,2],[3,1],[4,0],[0,5],[5,6]] restricted = [4,5] Output 4 Explanation Starting from node 0: Reachable nodes are 0, 1, 2, 3. Nodes ...

The full answer & interview discussion are available to premium members.

Log in Create a free account