In this post, we will solve the Picking Numbers HackerRank Solution. This problem (Picking Numbers) is a part of the HackerRank Problem Solving series.
Given an array of integers, find the longest subarray where the absolute difference between any two elements is less than or equal to 1.
a= [1, 1, 2, 2, 4, 4, 5, 5, 5]
Original Problem Link: https://www.hackerrank.com/challenges/three-month-preparation-kit-picking-numbers/problem