My way of solving the math challenge question