Solve common string/tree/grid interview tasks | Bloomberg Interview Question