Quick Overview

Resolve all collisions among asteroids moving left or right along one line, preserving survivors in original order. Use a stack to model only opposing-direction collisions and repeatedly compare any current asteroid that survives a smaller opponent.

Resolve Collisions Between Moving Asteroids

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Resolve all collisions among asteroids moving left or right along one line, preserving survivors in original order. Use a stack to model only opposing-direction collisions and repeatedly compare any current asteroid that survives a smaller opponent.

Read the full Amazon Software Engineer interview experience this question came from

Loading…