You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: lcci/01.04.Palindrome Permutation/README_EN.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,13 @@ impl Solution {
119
119
120
120
<!-- tabs:end -->
121
121
122
-
### Solution 2
122
+
### Solution 2: Another Implementation of Hash Table
123
+
124
+
We use a hash table $vis$ to store whether each character has appeared. If it has appeared, we remove the character from the hash table; otherwise, we add the character to the hash table.
125
+
126
+
Finally, we check whether the number of characters in the hash table is less than $2$. If it is, then it is a palindrome permutation.
127
+
128
+
The time complexity is $O(n)$, and the space complexity is $O(n)$. Here, $n$ is the length of the string.
0 commit comments