We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
每当用户执行变更文件夹操作时,LeetCode 文件系统都会保存一条日志记录。
下面给出对变更操作的说明:
给你一个字符串列表logs,其中logs[i]是用户在第i步执行的操作。
logs
logs[i]
i
文件系统启动时位于主文件夹,然后执行logs中的操作。
执行完所有变更文件夹操作后,请你找出 返回主文件夹所需的最小步数 。
输入:logs = ["d1/","d2/","../","d21/","./"] 输出:2 解释:执行 "../" 操作变更文件夹 2 次,即可回到主文件夹
输入:logs = ["d1/","d2/","./","d3/","../","d31/"] 输出:3
输入:logs = ["d1/","../","../","../"] 输出:0
提示:
来源:力扣(LeetCode) 链接:https://leetcode.cn/problems/crawler-log-folder 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
The text was updated successfully, but these errors were encountered:
class Solution { /** * @param String[] $logs * @return Integer */ function minOperations($logs) { $result = 0; foreach ($logs as $log) { if ($log === '../') { $result = $result > 0 ? $result - 1 : $result; continue; } else if ($log === './') { continue; } else { $result += 1; } } return $result; } }
Sorry, something went wrong.
No branches or pull requests
每当用户执行变更文件夹操作时,LeetCode 文件系统都会保存一条日志记录。
下面给出对变更操作的说明:
给你一个字符串列表
logs
,其中logs[i]
是用户在第i
步执行的操作。文件系统启动时位于主文件夹,然后执行
logs
中的操作。执行完所有变更文件夹操作后,请你找出 返回主文件夹所需的最小步数 。
示例1
示例 2:
示例 3:
提示:
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/crawler-log-folder
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
The text was updated successfully, but these errors were encountered: