Company: Ibm_2Nov
Difficulty: medium
Maximum Assigned Numbers 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. The test consists of m rounds. 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. This means that for a selected position p , the child at index j will be assigned the value abs(j - p) . 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