Flipkart Interview Question

Asteroid collision question from leetcode