RBC Interview Question

Easy leet code question on the board