摘要: Input: [1,1,2] Output: [ [1,1,2], [1,2,1], [2,1,1] ] 然而写了一个类似47的解竟然TLE了, 优化策略1. 统计整个字符串中每个字母的个数,如果奇数个的个数>1 ,则所有的permutation 都不可能符合要求。 做了这个优化后写了如下code, 阅读全文
posted @ 2018-11-15 03:24 KeepAC 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 给你一个字符串, 输出他的pattitioning 都是 palindrome 的组合 Input: "aab" Output: [ ["aa","b"], ["a","a","b"] ] 和93 题实际上一样, 给你个字符串长度比较是 3, 你相当于有一个nums = {1,2,3} 的数组,每次 阅读全文
posted @ 2018-11-15 03:11 KeepAC 阅读(109) 评论(0) 推荐(0) 编辑