Untitled
unknown
plain_text
a year ago
528 B
13
Indexable
def countViral(video, engagementArray, k):
count = 0
subset = []
def dfs(i):
nonlocal count
if i >= len(video):
if subset:
substring = "".join(subset)
weak_count = sum(engagementArray[ord(ch) - ord('a')] for ch in substring)
if 0 < weak_count <= k:
count += 1
return
subset.append(video[i])
dfs(i + 1)
subset.pop()
dfs(i + 1)
dfs(0)
return countEditor is loading...
Leave a Comment