Company: Zscalar_16nov
Difficulty: medium
Slow and Fast Pointers Problem Description Process an array using two pointers to determine the minimum valid segment size. 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. Determine the minimum value of segSize that allows the entire array to be processed successfully, or return -1 if not possible. 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 the process for arr = [11, 9, 10, 8, 10,