codes for programming challenge