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
}

京公网安备 11010502036488号