题解 | #牛群字母的集合#

牛群字母的集合

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
}

全部评论

相关推荐

点赞 评论 收藏
分享
头像
04-29 10:53
已编辑
东北大学 自动化类
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务