Company: Ibm_2Nov
Difficulty: medium
Maximum Assigned Numbers Problem Description n children stand in a line, numbered 0 through n-1 from left to right, for a memory drill that runs m rounds. In round i , the instructor points to the child at position pos[i] . That child is labeled 0 ; each child further right is labeled one more than the child directly to their left, and each child further left is labeled one more than the child directly to their right. Put differently, for a chosen position p , the child standing at index j ends up labeled abs(j - p) . For instance, with n = 6 and chosen position 3 , the labels come out as [3, 2, 1, 0, 1, 2] . Once all m rounds have run, report, for every child, the largest label they were ever given across those rounds. Examples Example 1: Input: n = 5 m = 4 pos = [3, 0, 1, 4] Output: [4, 3, 2, 3, 4] Explanation: Here is what each round labels: pos[i] Assignments pos[0] = 3 [3, 2, 1, 0, 1] pos[1] = 0 [0, 1, 2, 3, 4] pos[2] = 1 [1, 0, 1, 2, 3] pos[3] = 4 [4, 3, 2, 1, 0] The largest labe