Quora, Inc. Interview Question

Explain your code and how would you test it