Goldman Sachs Interview Question

2 Programming Questions of Medium Level