We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
leftsum = 0
rightsum = 0
for x in a[1:n]:
rightsum += int(x)
if leftsum == rightsum: return("YES")
for i in range(1,n):
leftsum += int(a[i-1])
rightsum -= int(a[i])
if leftsum == rightsum: return("YES")
return("NO")
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
Working Python code: