Yahoo interview question

some basic Javascript coding and leetcode