<reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/crawler-log-folder.py
# Time:  O(n)
# Space: O(1)

class Solution(object):
    def minOperations(self, logs):
        """
        :type logs: List[str]
        :rtype: int
        """
        result = 0
        for log in logs:
            if log == "../":
                if result > 0:
                    result -= 1
            elif log != "./":
                result += 1
        return result

and DSA/LeetCode-Solutions-master/Python/crawler-log-folder.py
# Time:  O(n)
# Space: O(1)

class Solution(object):
    def minOperations(self, logs):
        """
        :type logs: List[str]
        :rtype: int
        """
        result = 0
        for log in logs:
            if log == "../":
                if result > 0:
                    result -= 1
            elif log != "./":
                result += 1
        return result
# Time:  O(n) # Space: O(1) :type logs: List[str]         :rtype: int