HackerEarth interview question

A problem on Combinatorics