1426. Counting Elements
https://leetcode.com/problems/counting-elements
Description
Given an integer array arr
, count how many elements x
there are, such that x + 1
is also in arr
. If there are duplicates in arr
, count them separately.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
1 <= arr.length <= 1000
0 <= arr[i] <= 1000
ac
Last updated