You are given a list containing integers. Your task is to count how many sublists have the sum and additionally have the same first and last number.
The time complexity of the algorithm should be .
In a file sublists.py
, implement a function count
that returns the number of sublists.
def count(t): # TODO if __name__ == "__main__": print(count([2,3,-7,2])) # 1 print(count([1,2,3,4,5])) # 0 print(count([0,0,0,0,0])) # 15 print(count([2,1,-2,1,-1,1,-1,1])) # 3
Explanation: In the last test, the sublists are , and .