問題文
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 ]