Skip to content

1598. Crawler Log Folder #291

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to determine the minimum number of operations required to return to the main folder after performing a series of change folder operations. The operations can be moving to a parent folder, staying in the current folder, or moving to a child folder. The solution involves simulating these operations while keeping track of the current depth from the main folder.

Approach

  1. Initialization: Start at the main folder, represented by a depth of 0.
  2. Processing Logs: For each operation in the logs:
    • Move to Parent Folder ("../"): If the current depth is greater than 0, decrement the depth by 1. If already at the main folder (depth 0), the depth remains unchanged.
    • Stay in Current Folder ("./"):…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Jun 9, 2025
Maintainer Author

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jun 9, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants