Given an integer array arr, count the total number of elements x such that x + 1 is also present in arr.
If there are duplicate values in arr, each occurrence of x should be counted separately as long as x + 1 exists in arr.
Constraints:
arr.length
arr[i]
Given an integer array arr, count the total number of elements x such that x + 1 is also present in arr.
If there are duplicate values in arr, each occurrence of x should be counted separately as long as x + 1 exists in arr.
Constraints:
arr.length
arr[i]