Deloitte interview question

easy leet code questions and javascript functions