jump
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const canJump = (arr, pos = 0) => {
|
||||
if (pos >= arr.length) return true;
|
||||
if (pos === arr.length - 1) return false;
|
||||
for (let i = arr[pos]; i > 0; --i) {
|
||||
if (canJump(arr, pos + i)) return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user