Untitled

 avatar
unknown
plain_text
a year ago
456 B
6
Indexable
class Solution {
public:
    int minOperations(vector<string>& logs) {
        stack < string > st;
        
        for(int i=0;i<logs.size();i++) {
            if(logs[i] == "./")continue;
            
            if(logs[i] == "../") {
                if(!st.empty()) {
                    st.pop();
                }
            } 
            else {
                st.push(logs[i]);
            }
        }
        
        return st.size();
    }
};
Editor is loading...
Leave a Comment