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.
- Sherlock and Array
- Discussions
Sherlock and Array
Sherlock and Array
Sort by
recency
|
150 Discussions
|
Please Login in order to post a comment
short c++ solution using prefix sums - i-th element is the sum of all the previous elements + the i-th element of arr.
The test case is wrong! ( 2 0 0 0 & 0 0 2 0)
Constraints: 1 <= arr[i] <= 2 x 10^4
Javascript
C# SOLUTION
int[] intArray = arr.ToArray(); if (arr.Count() == 1){ return "YES"; } int[] startEndSums = { 0 , intArray[..].Sum() };