Practice Crawler Log Folder
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Start in the main folder and execute logs in order. ../ moves to the parent unless already at the main folder; ./ stays in place; x/ enters the existing child named x. Return the fewest parent-folder moves needed to return to the main folder afterward.
Source: Crawler Log Folder on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
logs = ["d1/","d2/","../","d21/","./"]
Output
2
# Example 2
Input
logs = ["d1/","d2/","./","d3/","../","d31/"]
Output
3
# Example 3
Input
logs = ["d1/","../","../","../"]
Output
0
Constraints
1 <= logs.length <= 10^3
2 <= logs[i].length <= 10
logs[i] contains lowercase English letters, digits, '.', and '/'.
logs[i] follows the format described in the statement.
Folder names consist of lowercase English letters and digits.
Related LeetCode Problems
Practice more problems similar to Crawler Log Folder.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.