Arista Networks Interview Question

A Leet Code type problem.