Insider One Interview Question

Basic JavaScript knowledge and basic algorithms