Meta interview question

One string manipulation and one tree question