Atlassian Interview Question

It was a Dynamic programming problem.