Back to problems

Simulate a File System with Access Control

Object-Oriented Programming · Dropbox · Medium

Problem Description You are given a hierarchical file system as a list of parent-child folder edges (List >) and a set of folders the user can already access (HashSet ). Build a function bool HasAccess(string folder) that reports whether the user may open a given folder. Permission is inherited downward: access to a parent grants access to all of its descendants. Input: folders: a list of two-element lists; each entry [parent, child] represents one folder directly inside…

Checking your access…