Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies following conditions:
where we define that subarray (L, R) represents a slice of the original array starting from the element indexed L to the element indexed R.
Example:
Input: [1,2,1,2,1,2,1] Output: True Explanation: i = 1, j = 3, k = 5. sum(0, i - 1) = sum(0, 0) = 1 sum(i + 1, j - 1) = sum(2, 2) = 1 sum(j + 1, k - 1) = sum(4, 4) = 1 sum(k + 1, n - 1) = sum(6, 6) = 1
Note:
[LeetCode] Split Array with Equal Sum 分割数组成和相同的子数组
原文:http://www.cnblogs.com/grandyang/p/6854492.html