dist[i] by speed[i] and store the results in an array arrival.arrival array in ascending order.ans to 0 to keep track of the number of monsters eliminated.arrival array and for each index i, check if arrival[i] <= i.
ans.ans which represents the maximum number of monsters that can be eliminated.