Untitled

Run Settings
LanguagePython
Language Version
Run Command
from random import shuffle def majoritySpecies(A): if len(A) == 2: if A[0] == A[1]: return [A[0]] else: return [] left = majoritySpecies(A[:len(A)//2]) right = majoritySpecies(A[len(A)//2:]) # x = [1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1] # print(majoritySpecies(x)) y = [1]*5 + [0]*3 shuffle(y) print(y) print(majoritySpecies(y))
Editor Settings
Theme
Key bindings
Full width
Lines