You are given a 0-indexed integer array nums and you need to find the total number of continuous subarrays.
A subarray is considered continuous if for each pair of indices i1 and i2 within the subarray, the absolute difference between nums[i1] and nums[i2] is at most 2.
The sliding window technique can be used to efficiently calculate the number of continuous subarrays.
The time complexity of the solution is O(n) and the space complexity is also O(n).