Google Interview Question

2 DP questions and 1 sliding window.