Microsoft Interview Question

How can you solve this challenge?