Company: Zscalar_16nov
Difficulty: medium
Problem Description Walk an array with two pointers to work out the smallest segment size that lets the whole array be processed. Given an array arr, process it using pointers P1 and P2 and a segment size segSize as follows: 1. Start with P1 = 0 and P2 = 1. 2. Compare arr[P1] with all elements in a subarray starting at arr[P2] and including segSize elements (or until the end of arr). 3. If arr[P1] is greater than or equal to all elements in the subarray, increment P1 by 1 and P2 by segSize. 4. Repeat until the entire array has been processed. Find the smallest segSize for which this whole process can run to completion, or return -1 if no such segSize exists. Complete the function dualSpeed in the editor with the following parameter: - int arr(n): an array of integers Returns int: the minimum segSize to allow all elements to be processed, or -1 if it is impossible. Examples Example 1: Walkthrough for arr = [11, 9, 10, 8, 10, 9] Let's trace what happens for arr = [11, 9, 10, 8, 10, 9] (l