// Find All Duplicates in an Array — EASY
// Category: array
Given an integer array `nums` of length `n` where all integers are in the range `[1, n]`, some elements appear **twice** and others appear **once**.
Return an array of all elements that appear **twice**, sorted in ascending order.
**Constraints:**
- `n == nums.length`
Example: nums = [4,3,2,7,8,2,3,1]
Output: [2,3]