Krononberg

1598. Crawler Log Folder.cpp 본문

개발 로그/알고리즘

1598. Crawler Log Folder.cpp

k._. 2021. 12. 15. 19:52

class Solution {
public:
    int minOperations(vector<string>& logs) {
        int res =0;
        for(auto l : logs){
            if (l.find("..") != std::string::npos) {
                if(res!=0) res--;
            }
            else if(l.find(".") == std::string::npos){
                res++;
            }
        }
        return res;
    }
};

'개발 로그 > 알고리즘' 카테고리의 다른 글

49. Group Anagrams.cpp  (0) 2021.12.16
1078. Occurrences After Bigram.cpp  (0) 2021.12.15
1694. Reformat Phone Number.cpp  (0) 2021.12.15
575. Distribute Candies.cpp  (0) 2021.12.15
884. Uncommon Words from Two Sentences.cpp  (0) 2021.12.15