Domanda di colloquio di Yahoo

all of them are not difficult. basic C/c++ and algorithm problem