Atlassian interview question

Maximum grid problem