MasTek (CA) Interview Question

Python Java DSA arrays logic