Description
Submission
class Solution { public: int minOperations(vector<string>& logs) { stack<string> stk; for(string& l: logs) { if(l == "./") { continue; } else if(l == "../") { if(!stk.empty()) stk.pop(); } else { stk.push(l); } } int res = 0; while(!stk.empty()) { res++; stk.pop(); } return res; } };