Wrote solution to 12 but it violates time limit