Walmart Interview Question

Javascript coding algorithm in whiteboarding