Retention Policy Collision
Box Governance customers can create Retention Policies that will hold files for a certain length of time. When placed on a folder, all files in that folder can not be deleted until the length of time has passed. Once a Retention Policy has been created and put on a folder, the customers can move the policy up and down their folder tree onto different folders.
There are n Retention Policies placed on the Box folder tree that constantly love up or down the folder tree onto
different folders. The folder tree is infinitely long, so policies will move up or down infinitely.
direction[i] represents the direction in which the i-th Retention Policy is moving with -1 meaning that it is
moving up the folder tree and 1 meaning it is down the folder tree. The policy length (how long the policy will hold files for) of
the i-th Retention Policy is described by length[i]. If 2 Retention Policy collide, the one with the higher length destroys the
smaller one. If both have the same length, both are destroyed. Return a list of the indices of the policies that remain after all the collisions have occured, in an ascending order.
Note that the array direction and length are 0-indexed.
Complete the function findRemainingPolicies in the editor.