美文网首页Leetcode
【回溯法】17.Letter Combinations of a

【回溯法】17.Letter Combinations of a

作者: 安琪拉的小迷妹 | 来源:发表于2018-07-26 11:25 被阅读0次

题目链接

https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/

回溯搜索是深度优先搜索(DFS)的一种

https://blog.csdn.net/XX_123_1_RJ/article/details/80947129

很显然是,是回溯题目,递归求解,可以使用深度优先(dfs)的思想。

(1)用 index 记录 digits 字符串中的字符索引

(2)用 paths 表示走过的字符,走到头,就保存到 res, 然后回溯当上一层,继续。

(3)这个过程相当于深度优先搜索。

相关文章

网友评论

    本文标题:【回溯法】17.Letter Combinations of a

    本文链接:https://www.haomeiwen.com/subject/cdnvmftx.html