Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Home Coming by tokiojapan55
from typing import List
def home_coming(souvenirs: List[int], s: int) -> int:
result = 1
for l in range(len(souvenirs)):
bring,exclude = [souvenirs[l]],[]
for r in range(l+1, len(souvenirs)):
item = souvenirs[r]
if item not in exclude:
if bring.count(item)>=s:
exclude.append(item)
else:
bring.append(item)
cnt = len([b for b in bring if b not in exclude])
if result
May 20, 2020