Skip to content

Instantly share code, notes, and snippets.

@hrubantjakub1
Last active April 21, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrubantjakub1/6509fc98dfcfd4cb693973084ebef43b to your computer and use it in GitHub Desktop.
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
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