Bruteforce and Optimal | C++
1. Bruteforce Approach | O(n^2) time, O(n) space, n = nums.length\n\ncpp\nclass Solution_1 {\npublic:\n    bool findSubarrays(vector<int> &nums) {\n        int 
**1. Bruteforce Approach | O(n^2) time, O(n) space, n = nums.length**\n\n```cpp\nclass Solution_1 {\npublic:\n    bool findSubarrays(vector<int> &nums) {\n        int n = nums.size();\n        int arr[n - 1];\n        for (int i = 1; i < n; i++) {\n            arr[i - 1] = nums[i] + nums[i - 1];\n        }\n        for (int i = 0; i < n - 1; i++) {\n            for (int j = i + 1; j < n - 1; j++) {\n                if (arr[i] == arr[j]) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n};\n```\n\n<br>\n\n**2. Optimal Approach | O(n) time, O(n) space, n = nums.length**\n\n```cpp\nclass Solution {\npublic:\n    bool findSubarrays(vector<int> &nums) {\n        int n = nums.size();\n        unordered_set<int> ans;\n        for(int i = 1; i < n; i++){\n            ans.insert(nums[i] + nums[i - 1]);\n        }\n        if (ans.size() == (nums.size() - 1)){\n            return false;\n        }\n        return true;\n    }\n};\n```
['C', 'C++']