728x90
def solution(elements):
n=len(elements)
s=set(elements)
for i in range(1, n+1):
for j in range(n):
if i+j < n:
s.add(sum(elements[j:j+i]))
else:
s.add(sum(elements[j:]) + sum(elements[:i+j-n]))
return len(s)
def solution(elements):
n = len(elements)
elements = elements*2
s = set()
for i in range(n):
for j in range(i,n+i):
s.add(sum(elements[i:j]))
return len(s)
728x90