solution to interview challenge