ByteDance interview question

3 coding questions in Python on HackerRank