Google interview question

time complexities, dynamic programming coding question