2, enter a interval [n, m], where 0 & lt;=n<=m<=100, if a, b, c are interval [n, m), as much as possible, please find the in the interval [n, m] satisfy conditions: a2 + b2=c2. A, b, c values,
Solving!!!!!!
CodePudding user response:
Recently saw a bit of vue - the source code of the router, which triggered queue hook function, use the similar wording, you can refer to:
Var arr=[' liu ', 2, '456')
The function itor (item, cb) {
The new Promise ((resolve, reject)=& gt; {
SetTimeout ()=& gt; {
The console. The log (' item 'item);
The resolve ()
}, 2000)
}). Then (cb)
}
The function runQueue (arr, itor, cb) {
Var step index of==& gt; {
If (index>=arr. Length) {
Cb ()
} else {
Itor (arr [index], ()=& gt; {
Step (index + 1)
})
}
}
Step (0)
}
RunQueue (arr, itor, ()=& gt; {the console. The log (' over ')})