Meta Interview Question

One string manipulation and one tree question