IBM interview question

network request and general code alg