You are viewing a single comment's thread. Return to all comments →
TS
function balancedSums(arr: number[]): string { const sum = arr.reduce((total, el) => total + el, 0); let sumLeft = 0, sumRight = sum; for(let i = 0; i < arr.length; i++) { sumRight -= arr[i]; if (sumLeft === sumRight) { return "YES"; } sumLeft += arr[i]; } 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 →
TS