Databricks·Software Engineer·Technical Phone Screen
- You have a root directory with files and nested subdirectories. Some files are already encrypted, some aren't. You have two APIs: one encrypts a single file with a fixed request overhead plus a per-file cost, and another batch-encrypts all unencrypted files in a given directory and all its subdirectories, also with a fixed overhead but only one per-file cost multiplied by the count. Find the minimum total time to encrypt all unencrypted files.
“The part that tripped me up was figuring out when it's actually cheaper to call the directory API versus just looping individual files.”