Company: Visa__...
Difficulty: medium
Distribute Elements Into Two Arrays II Problem Description Given an array of integers numbers , distribute all of its integers between two arrays, first and second , based on the following rules: Rules: The first number, numbers[0] , goes to the first array. The second number, numbers[1] , goes to the second array. Each following number, numbers[i] where i > 1 , goes to the array with the higher number of elements that are strictly greater than numbers[i] . In case of a tie (equal count of strictly greater elements), numbers[i] goes to the array with a lower length. If it is still a tie (equal counts and equal lengths), numbers[i] goes to the first array. Output: Return a single array - the combination of first and second by appending all elements of second to the end of first . Examples Example 1: Input: numbers = [5, 7, 6, 9, 2] Output: [5, 9, 2, 7, 6] Explanation: numbers[0] = 5 -> first array. ( first=[5] , second=[] ) numbers[1] = 7 -> second array. ( first=[5] , second=[7] ) numb