Intel Corporation interview question

2 technical questions from leetcode