Algorithm · Google · Medium
Given an integer array, decide whether all of its elements can be arranged into consecutive-number subsequences, with every subsequence containing exactly 5 values. Write a function for this task that returns a boolean result. Input: An array of integers. Output: A boolean value showing whether the array can be partitioned into groups of 5 consecutive integers. Test cases: Input: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12] Output: True Explanation: The values form the two consecutive…
Checking your access…