Pregunta de entrevista de Fingerprint

An efficient algorithm question using JS