Adding solution for problem 23

Could be much more efficient but this is fast enough and much more concise