Company: Ibm_5nov
Difficulty: medium
Question 1 Problem Description A memory test is being conducted for n students standing in a row, numbered from 0 to n-1 from left to right. In each round, the teacher selects a position pos[i] for round i . The child at that position will be assigned the number 0. All children to the right of the selected position will be assigned a number that is one greater than the child to their left, and all children to the left of the selected position will be assigned a number that is one greater than the child to their right. For example, if n = 6 and the selected position is 3, the numbering is [3, 2, 1, 0, 1, 2]. After m rounds, the teacher asks each student to shout out the greatest number that was assigned to them during the m rounds. Your task is to determine the value each child will shout. Examples Example 1: Input: n = 5, m = 4, pos = [3, 0, 1, 4] Output: [4, 3, 2, 3, 4] Explanation: The assignments for each round are as follows: Assigned Numbers per Round pos[i] | Assignments --------