题目说明
编写 function solution(statuses, baseMs, maxMs)。输入输出均为 JSON 值,不要修改输入数组或对象。不支持外部库、网络访问及异步函数。 statuses:integer[] (100–599); baseMs,maxMs:integers 0–10^6. First attempt starts at 0. Append the time of each processed response. Stop after a 2xx success or a 4xx except 408/429. Otherwise add min(maxMs,baseMs*2^i) after response i, zero-based. Do not create attempts beyond the supplied responses. Return the attempt-time array. 输入范围:每个输入数组最多50,000项,每个字符串最多1,000个字符。数字必须有限,整数及整数累计结果在JavaScript安全整数范围内。其他类型和有效性遵循上述规则。
输入输出示例
示例 1
函数参数
[
[
500,
500,
200
],
100,
1000
]返回值
[ 0, 100, 300 ]
示例 2
函数参数
[
[
429,
408,
503,
200
],
10,
25
]返回值
[ 0, 10, 30, 55 ]
示例 3
函数参数
[
[
401
],
1,
10
]返回值
[ 0 ]