AT&T interview question

they asked me to solve a tough coding problem.