D2L interview question

Simple leetcode problems, find problems with this example UI, debug / tell me what's wrong with this code