Daily challenge for 2026-10-31
669. Document Folder Depth
You are given a list of string operations representing navigating a file system. The operations are:
- "../": Move up one folder (if you are already in the root folder, you remain there).
- "./": Remain in the current folder.
- "x/": Move down into a child folder named x.
The file system starts at the root folder. Return the minimum number of operations required to go back to the root folder after executing all the given operations.
Constraints:
There are 0–2,000 log entries. Entries are ../, ./, or a non-empty folder name followed by /. Folder names do not contain /. Moving above the main folder leaves the depth at 0.
Example:
Input: ops = ["d1/", "d2/", "../", "d21/", "./"]
Output: 2
Run this challenge interactively in Python or JavaScript when the app loads.