Atlassian interview question

LC easy problem for list