Waymo Interview Question

Solve a grid based C++ question