NVIDIA interview question

One logical question and one leetcode style quesiton