Atlassian interview question

1: dp 2: prefix sum + binary search 3: easy one