Company: Impetus_21nov
Difficulty: medium
Strong Elements Problem Description You are given an array arr of n elements. Each element has a size such that the size of the i-th element is given by |arr[i]| (the absolute value of arr[i]). At time t = 0, all the elements of the array start moving with the same speed. If arr[i] is positive, the element moves towards the right. If arr[i] is negative, the element moves towards the left. Thus, a number of collisions between the elements will take place. When two elements collide, the element with the larger size continues moving as it is and the smaller element vanishes. If two elements of the same size collide, they both vanish. Find the elements that will remain after all collisions have taken place. Let array B contain the remaining elements in order, from left to right. Output array B. Note: - If there are no elements remaining, return an empty array. Examples Example 1: Input: n = 5, arr = [4, 5, -6, 7, -4] Output: [-6, 7] Explanation: The initial array arr = [4, 5, -6, 7, -4]. T