HexArmor Interview Question

ruby and javascript DSA question,