@awice Ah yes I should have just done the test myself instead of asking. It is pretty amazing that running min and max is almost an entire order of magnitude faster than finding the answers using a Python loop.

Use an example to explain.
DP idea: dp[i] is the largest average value end with nums[i]
if we have an array [46, 46, 46, 47, 47, 47, 1] k = 3;
so dp array is [0, 0, 46, (47+46+46)/3, (47+47+46)/3 ,47 ,(47+47+47+1)/4)]
but the correct answer for last element in dp array should be (46+46+46+47+47+47+1)/7.

@Hao-Cai The running time is round 100ms, at least beats 90%. The time of binary search is almost same. But the result is more accurate. Of course, both methods satisfy the 10-5 requirment.