AMD interview question

Do a leetcode easy problem