Siemens interview question

Leetcode questions (easy level), two rounds