Atlassian interview question

Needle in haystack leetcode question