Matsushita's Blog

If the string is a permutation of another string

Problem

Given two strings, write a method to decide if one is a permutation of the other.

How to Solve

In oder to count of the number that how many times each characters appeared, I use array like HashMap. In case the given strings is ASCII, each character can be transformed into integer (the max value is 256) So, I can control the count by the array.

Source Code