You are viewing a single comment's thread. Return to all comments →
C# SOLUTION
int[] intArray = arr.ToArray(); if (arr.Count() == 1){ return "YES"; } int[] startEndSums = { 0 , intArray[..].Sum() };
for (int i = 0; i < arr.Count(); i++){ startEndSums[1] -= intArray[i]; if (startEndSums[0] == startEndSums[1]) return "YES"; startEndSums[0] += intArray[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 →
C# SOLUTION
int[] intArray = arr.ToArray(); if (arr.Count() == 1){ return "YES"; } int[] startEndSums = { 0 , intArray[..].Sum() };