You are viewing a single comment's thread. Return to all comments →
Python 3
def sumarr(arr, n, m): sh = 0 sv = 0 for i in range(len(arr)): if i != m: sv += arr[i][n] if i != n: sh += arr[m][i] return sh == sv def organizingContainers(container): l = len(container) arr = ['0']*l for i in range(l): for j in range(l): if arr[j] == '1': continue if sumarr(container, i, j): arr[j] = '1' break if arr == ['1']*l: return 'Possible' else: return 'Impossible'
Seems like cookies are disabled on this browser, please enable them to open this website
Organizing Containers of Balls
You are viewing a single comment's thread. Return to all comments →
Python 3