Implement automatic braking logic in Python
TeslaMachine Learning Engineer · Technical ScreenLast updated
This question evaluates understanding of kinematics, motion modeling, and numerical reasoning for safety-critical control logic, focusing on stopping-distance computation and the impact of reaction time on braking decisions.
Using Python, implement a simple automatic braking function. Given current speed v (m/s), distance to obstacle d (m), maximum deceleration a_max (m/s^ 2), and reaction time t_r (s), decide whether to brake immediately to stop before the obstacle; return the braking decision, braking start time, and expected stopping distance.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.