AKUNA CAPITAL interview question

HackerRank coding challenge in Python, 3 questions