PhysicsX interview question

Hackerrank test. Questions fairly easy but need to work quickly.