Problem 24 Custom Solution