Skip to content

Files

Latest commit

author
Shuo
Nov 27, 2021
cb30580 · Nov 27, 2021

History

History

palindrome-permutation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 27, 2021
Nov 12, 2019
Nov 12, 2019

README.md

< Previous                  Next >

Given a string, determine if a permutation of the string could form a palindrome.

Example 1:

Input: "code"
Output: false

Example 2:

Input: "aab"
Output: true

Example 3:

Input: "carerac"
Output: true

Related Topics

[Hash Table] [String] [Bit Manipulation]

Similar Questions

  1. Longest Palindromic Substring (Medium)
  2. Valid Anagram (Easy)
  3. Palindrome Permutation II (Medium)
  4. Longest Palindrome (Easy)

Hints

Hint 1 Consider the palindromes of odd vs even length. What difference do you notice?
Hint 2 Count the frequency of each character.
Hint 3 If each character occurs even number of times, then it must be a palindrome. How about character which occurs odd number of times?