Microsoft interview question

How would you code in less time this ...?