leetcode
leetcode copied to clipboard
Bug Report for crawler-log-folder
Bug Report for https://neetcode.io/problems/crawler-log-folder
My solution was:
class Solution:
def minOperations(self, logs: List[str]) -> int:
def distance(logs=[], dist=0):
if len(logs) == 0:
return dist
pattern_1 = r'[a-z](\d+)/'
match_1 = re.match(pattern_1, logs[0])
if match_1:
dist += 1
elif logs[0] == "../":
dist -= 1
elif logs[0] == "./":
pass
return distance(logs[1:], dist)
return max(0, distance(logs, 0))
And for the second use case, the expected output is wrong in the testing system:
This is clearly wrong as the expected output for the test case is also shown to be 0 in the example for the question: