Reported interview periodApr 2026–Sep 2026
Minimize Encryption Work in a File Tree
A file hierarchy contains directories and files. Some files are already encrypted. You may encrypt an individual file or issue one recursive encryption request for an entire directory. Choose operations with mi…
Practice focusRequirements and cost model - Encrypting one file costs t req + t file . - Encrypting a directory costs t req + N t file , where N is every file in its subtree, including already-encrypted files. - A subtree with no unencrypted files costs 0 . - At a directory, you may batch the whole subtree or solve its children independently. count files returns (encrypted count, unencrypted count) . The input is a finite tree of FileNode and DirectoryNode objects, with boolean encryption flags, no cycles or shared nodes, and non-negative integer costs.…