Question: Healthy robots Given N robots in a line facing left or right with positive health. They move simultaneously and collide when they meet. The robot
Healthy robots
Given N robots in a line facing left or right with positive health. They move simultaneously and collide when they meet. The robot with less health is knocked out of the line, and the robot with more health continues moving in the same direction with its health reduced by the opponent's health. If two robots have the same health, both are knocked out. The health and direction of each robot are stored in a D array A of size N where Ai is the health and Ai is the direction for left, for right Find the health and direction of the robots that remain after all the collisions, in the same order as they appeared
Previous Question
Next Question
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
