JavaScript算法题 - dfs

32 阅读1分钟

JavaScript遍历实现DFS算法和BFS算法_javascript技巧_脚本之家 (jb51.net)

46. 全排列

image.png

遍历数组

//for(let i = 0 ; i < coins.length < i ++){}
for(const coin of coins){}

复制数组

let arr = [-1, 0, 3, 5, 9, 12]
let ans = [0,0,0]
ans = arr.slice()
console.log(ans); //[ -1, 0, 3, 5, 9, 12 ]

题解

leetcode.cn/problems/pe…