题解 | #牛群字母的集合#
牛群字母的集合
https://www.nowcoder.com/practice/5aa097cccc0241febe1054bd85ce299b
function cowCombination( s ) {
// write code here
let ans = []
const tracingback = (path,idx) => {
ans.indexOf(path.join("")) == "-1" && ans.push(path.join(""))
for(let i=idx;i<s.length;i++) {
path.push(s[i])
tracingback(path,i+1)
path.pop()
}
}
tracingback([],0)
return ans
}