Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 483 Bytes

1598.md

File metadata and controls

20 lines (18 loc) · 483 Bytes

1598. Crawler Log Folder

Solution 1

class Solution(object):
    def minOperations(self, logs):
        """
        :type logs: List[str]
        :rtype: int
        """
        cur_level = 0
        for cur_log in logs:
            if len(cur_log) > 1 and cur_log[0] == ".":
                if len(cur_log) > 2 and cur_log[1] == "." and cur_level != 0:
                    cur_level -= 1
            else:
                cur_level += 1
        return cur_level