Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is less than or equal to 1. For example, if your array is [1, 1, 2, 2, 4, 4, 5, 5, 5], you can create two subarrays meeting the criterion: [1, 1, 2, 2] and [4, 4, 5, 5, 5]. The maximum length of the subarray has 5 elements. Programm should return an integer that represents the length of the longest array that can be created.
Make your attention to the constraints of this exercise. Elements can be in the range from 0 to 100. So the maximum we can have 100 numbers. I decide to do the next steps: