Question d’entretien chez Qualcomm

Basic bit manipulation question, with a dynamic programming twist.