Airbus Interview Question

Asked to solve balancing equations coding challenge