LintCode新题 - Split String

题目:
Give a string, you can choose to split the string after one character or two adjacent characters, and make the string to be composed of only one character or two characters. Output all possible results.

样例

Given the string "123"
return [["1","2","3"],["12","3"],["1","23"]]

请教下大家,有解题思路吗?

全部评论
就是一个回溯法,每个位置可以切分可以不切分,但是需要注意题目要求间隔为2的时候必须要切分就可以了
点赞 回复 分享
发布于 2017-09-22 16:59
或者你dp(i)保存前i个可以切成啥,反正字符串也不会太长
点赞 回复 分享
发布于 2017-09-22 17:43
回溯法,DFS
点赞 回复 分享
发布于 2017-09-22 16:08

相关推荐

程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
给🐭🐭个面试机会...:我擦seed✌🏻
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务