Company: Agoda_25july
Difficulty: medium
Find Remaining Balls Problem Description There are N balls placed on a 1-dimensional axis, all moving at the same non-zero speed. For each ball: direction[i] represents the direction ( -1 for left, 1 for right) strength[i] represents the strength of the ball. When two balls collide: If one ball has higher strength, it destroys the weaker one and continues moving. If both have equal strength, both are destroyed. Return the zero-based indices of the balls that remain after all collisions, in ascending order. Function Description Complete the function findRemainingBalls in the editor with the following parameter(s): int direction[n] : the directions of the particles in order of their starting relative positions. int strength[n] : the strengths of the particles. Returns int[] : an integer array that contains the zero-based indices of the remaining balls in ascending order. Examples Example 1: Input: N = 3 direction = [1, -1, 1] strength = [3, 1, 1] Output: [0] Explanation: The first and th