solution 5 - takes 2 to 3 seconds to complete