今際の国の呵呵君
Saturday, September 23, 2017
[LeetCode]Palindrome Permutation II
还是一道backtracking的题目,因为是回文,我们只需要construct一半然后mirror另一半即可,注意一下数量为奇数的字符。空间复杂度O(n),时间复杂度O(k),k为排列的数量。代码如下:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment