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
|
153 Discussions
|
Please Login in order to post a comment
Javascript
My Solution using javascript
how can [2 0 0 0] has expected answer "YES"?
The first element can be the split. Then leftsum will be 0(since there is no element on the left of the first one) and A[1]+A[2]+A[3] = 0
short c++ solution using prefix sums - i-th element is the sum of all the previous elements + the i-th element of arr.
This code gives 'YES' for the following input. But there is no index to satisfy the condition. The right answer should be "NO". 1 4 1 1 1 1