BEATS 100% of solutions sliding window approach in O(N) Python
Intuition\nMy intution when first approaching this problem is finding a way to calculate all subarrays of size 2, and how to check if the sum already exists.\n\
# Intuition\nMy intution when first approaching this problem is finding a way to calculate all subarrays of size 2, and how to check if the sum already exists.\n\n# Approach\nMy apporach was using a sliding window with left and right pointers 1 index appart to calculate the sum of a given subarray of size 2. Given the sum of the two indicies, I used a set of to check if the sum already existed in the subarray, if not it would be addded to the set.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```python3 []\nclass Solution:\n    def findSubarrays(self, nums: List[int]) -> bool:\n        left = 0\n        right = 1 \n        sums = set()\n        while right < len(nums):\n            if nums[left] + nums[right] in sums:\n                return True\n            else:\n                sums.add(nums[left]+nums[right])\n            left+=1\n            right+=1\n        return False \n```
['Python3']