Algorithm · Square · Medium
You are given the coordinates of a set of planets. The task is broken into several stages. First, for every planet, calculate how far it lies from the origin. Next, simulate attacks using two types of weapons: one that destroys a single targeted planet, and one that destroys everything within a given radius of its blast. After the attacks are carried out, determine which planets are still standing. Finally, given the cost associated with each kind of weapon, find the least…