NVIDIA interview question

it was a leetcode easy