class Solution {
public:
int minOperations(vector<string>& logs)
{
int depth = 0;
for (string log : logs)
{
if (log == "../")
{
depth = max(0, --depth);
}
else if (log != "./")
{
++depth;
}
}
return depth;
}
};
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up