Booz Allen Hamilton Interview Question

Solve a counting problem and describe time complexity of the solution