Last active
April 21, 2017 14:09
-
-
Save hrubantjakub1/6509fc98dfcfd4cb693973084ebef43b to your computer and use it in GitHub Desktop.
my solution for MaxCounters codility task in Python + codesays community solution, solved in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solution (N, A): | |
counters = [0] * N # number_of_counters | |
for K in A: | |
if 1 <= K <= N: | |
counters[K-1] += 1 | |
elif K > N: | |
max_value = max(counters) | |
for index in range(len(counters)): | |
counters[index] = max_value | |
return counters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment