Company: D.E.Shaw_19july
Difficulty: medium
Collect Files Problem Description In an office, there is a stack of files arranged in a line, each with an importance level. These files are numbered consecutively from 1 to n, with their importance increasing as the number increases. An office employee is tasked with collecting these files and delivering them to the manager's desk. To ensure the process is smooth and efficient, the employee follows this strategy: The employee picks up the leftmost file. The employee moves to the next file on the right. The employee picks up the file if its importance is strictly less than the last file they picked up. Repeat step 2 until there are no more files to the right. The employee places all the collected files on the manager's desk and returns to the start. Repeat from step 1 until all files are collected. Each trip from left to right to collect files is called a "round". Determine the list of files the employee collects during each round. Complete the function collectFiles in the editor below