Given a sorted array nums and an integer k, count the number of pairs (i, j) with i < j such that nums[j] - nums[i] < k.
Input: A sorted integer array nums and integer k.
Output: Count of pairs (i,j) where i<j and nums[j]-nums[i] < k.
Input: [1,2,3,4,5], 2
Output: 4
Explanation: Pairs with diff<2: (1,2),(2,3),(3,4),(4,5). Count=4.Input: [1,2,3,4,5], 5
Output: 8
Explanation: All pairs with diff<5: (1,2),(1,3),(1,4),(2,3),(2,4),(2,5),(3,4),(3,5). Count=8.Input: [1,10,20,30], 5
Output: 0
Explanation: Minimum diff is 9 >= 5. No valid pairs.2 <= nums.length <= 10^30 <= nums[i] <= 10^9Sorted ascending1 <= k <= 10^9