slice interview question

Ideas on optimizing technical problems.