Created
January 11, 2016 15:10
-
-
Save aj07mm/08a9e2d270a9e9255c6a to your computer and use it in GitHub Desktop.
codility-demo.py
This file contains hidden or 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 equilibrium(A): | |
P_arr = [] | |
ini_range = 1 | |
end_limit = len(A) - 2 | |
for x in xrange(ini_range, end_limit): | |
sum_prev = sum(xrange(ini_range,x-1)) | |
sum_pos = sum(xrange(x+1,end_limit)) | |
if(sum_prev == sum_pos): | |
P_arr.append(x) | |
return P_arr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment