Atlassian Interview Question

standard leet code (medium difficulty)