O(1) space complexity without modity original nums
it is very similar like this solution ,but i calculate the sum to avoid modify origianal nums.\nhttps://leetcode.com/problems/ways-to-split-array-into-three-sub
it is very similar like this solution ,but i calculate the sum to avoid modify origianal nums.\nhttps://leetcode.com/problems/ways-to-split-array-into-three-subarrays/discuss/999257/C%2B%2BJavaPython-O(n)-with-picture\n```java\nclass Solution {\n    public int waysToSplit(int[] nums) {\n        int n=nums.length;\n        int j=-1,k=-1,si=0,sj=0,sk=0,ans=0,mod=(int)1e9+7;\n        int sum=0;\n        for (int num:nums) sum+=num;\n        for (int i=0;i<n-2;i++){\n            si+=nums[i];\n            while (j<=i || (j<n-1 && sj-si<si)) \n                sj+=nums[++j];\n            while (k<j || (k<n-1 && sum-sk>=sk-si)) \n                sk+=nums[++k];\n            ans=(ans+k-j)%mod;\n        }\n        return ans;\n    }\n}\n```
['Two Pointers']