2 pointers solution TLE for Python & C#
I see a post using 2 pointer solution with JAVA.\nBut my below 2 pointer solution with both Python & C# got TLE.\nPlease advise.\n\nclass Solution:\n    def way
I see a post using 2 pointer solution with JAVA.\nBut my below 2 pointer solution with both Python & C# got TLE.\nPlease advise.\n```\nclass Solution:\n    def waysToSplit(self, n: List[int]) -> int:\n        s = [n[0]]\n        for i in range(1, len(n)):\n            s.append(s[-1]+n[i])\n        l,m,r=0,1,len(n)-1\n        lastm = 0\n        res = 0\n        while l<r:\n            while l<r and s[l]>s[-1]-s[r-1]:\n                r -= 1\n            if l==r:\n                break\n            m = lastm if lastm>l+1 else l+1\n            while s[l]>s[m]-s[l] and m<r:\n                m += 1\n            if m==r:\n                l+=1\n                continue\n            lastm = m\n            while m<r and s[m]-s[l]<=s[-1]-s[m]:\n                res += 1\n                m += 1\n            l += 1\n        return res%1000000007\n```
[]