Back to problems

Search a Folder Hierarchy with Extensible Document Filters

Algorithm · Amazon · Medium

Implement a flexible search function over a folder-document tree. The function must return document identifiers that satisfy given conditions based on size and type. The design should allow adding new filter conditions without altering the core traversal logic. Each node in the hierarchy is represented as a string array [id, parentId, kind, size, type]. The id is a unique non-empty ASCII string. parentId is empty only for the root folder. The kind is either "FOLDER" or…

Checking your access…