### Problem
The degree of nums is its highest value frequency. Return the minimum length of a contiguous subarray having the same degree as the entire array.
```cpp
class Solution {
public:
int findShortestSubArray(vector<int>& nums);
};
```
### Examples
**Example 1:**
```text
nums = [4,1,4,2,1,1]
Output: 5
Explanation: One occurs three times; the shortest preserving span runs from index 1 to 5.
```
**Example 2:**
```text
nums = [7,8,9]
Output: 1
Explanation: The degree is one, so any singleton suffices.
```
### Constraints
- The nonempty array contains at most 50000 integers. Values range from 0 through 49999.
### Clarifying Questions
Preserve maximum frequency while comparing the full occurrence spans of all tied values.
```hint Read the boundary condition
What interval is forced if a subarray must include every occurrence of a degree-achieving value?
```
### Contract considerations
Preserve maximum frequency while comparing the full occurrence spans of all tied values.
Overview: Find the Shortest Segment Preserving Array Degree. The degree of nums is its highest value frequency.