Simple Sliding Window Approach
\n\n# Approach\n- Keep track of sum of array of size 2.\n- Keep on sliding the window ,and at any point if curr window sum was present before , return true.\n\n
\n\n# Approach\n- Keep track of sum of array of size 2.\n- Keep on sliding the window ,and at any point if curr window sum was present before , return true.\n\n\n# Code\n```\nclass Solution {\npublic:\n    bool findSubarrays(vector<int>& a) {\n        int n=a.size(), l=0, r=2;\n        if(n<=1)\n          return false;\n        int currWindowSum = a[0]+a[1];\n        unordered_set<int>s;\n        s.insert(currWindowSum);\n        while(r<n)\n        {\n           currWindowSum=currWindowSum-a[l];\n           currWindowSum=currWindowSum+a[r];\n           l++;\n           r++;\n           if(s.find(currWindowSum)!=s.end())\n             return true;\n           s.insert(currWindowSum);\n        }\n        return false;\n       \n    }\n};\n```
['Sliding Window', 'C++']