Detect Equal Sums among Different Adjacent Pairs
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Other
### Problem
Return whether `nums` contains two length-two contiguous subarrays with the same sum and different starting indices. The subarrays may overlap; equal element sequences still count separately at different positions.
```cpp
class Solution {
public:
bool findSubarrays(vector<int>& nums);
};
```
### Examples
**Example 1:**
```text
Input: nums = [1,4,1]
Output: true
Explanation: The overlapping pairs [1,4] and [4,1] both sum to 5.
```
**Example 2:**
```text
Input: nums = [1,3,6]
Output: false
Explanation: The only pair sums are 4 and 9.
```
### Constraints
- `2 <= nums.length <= 1000`.
- `-10^9 <= nums[i] <= 10^9`.
### Clarifying Questions
- May the two subarrays overlap? Yes.
- Can their contents be identical? Yes, if they start at different indices.
- Can one subarray be used twice? No; the starting indices must differ.
- Are negative values permitted? Yes.
```hint Check the boundary
A length-two array has only one candidate subarray.
```
Overview: Detect two adjacent-pair subarrays with equal sums and different starts, allowing overlap and repeated contents.