problem266

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

266. Palindrome Permutation (Easy)

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

[Hash Table]

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?

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL