You are viewing a single comment's thread. Return to all comments →
low,high=0,len(arr)-1 sumleft=arr[low] sumright=arr[high] while low!=high: if sumleft < sumright: low=low+1 sumleft+=arr[low]
else : high-=1 sumright+=arr[high] if sumleft==sumright: return 'YES' else: return 'NO'
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 →
NEW
low,high=0,len(arr)-1 sumleft=arr[low] sumright=arr[high] while low!=high: if sumleft < sumright: low=low+1 sumleft+=arr[low]