You are viewing a single comment's thread. Return to all comments →
Can someone explain this problem, I can't understand why my code it's notw working in all cases. I've coded in Python 3. Sorry for posting my code:
def turnOffTheLights(k, c): len_c = len(c) if len_c <= 2 * k + 1: return min(c) soma = 0 minimal = sum(c) for i in range(k + 1): soma = 0 while i <= (len_c - 1): soma += c[i] i += 2 * k + 1 if soma < minimal: minimal = soma return minimal
Seems like cookies are disabled on this browser, please enable them to open this website
Turn Off the Lights
You are viewing a single comment's thread. Return to all comments →
Can someone explain this problem, I can't understand why my code it's notw working in all cases. I've coded in Python 3. Sorry for posting my code: