EasyString · Frequency Count
LeetCode #242

Valid Anagram

Given two strings, decide whether one can be made from the other by only rearranging its characters.

In very simple words

Both words must use the same letters, and every letter must appear the same number of times. Their order does not matter.

anagram ↔ nagaram

true — same letters and counts

rat ↔ car

false — the letters differ

Have you solved it before?

The final answer stays hidden in both modes.

Solve It With Small Hints

Read one hint, pause, and try again before opening the next.

Step 1

Say the question in your own words

The order may change, but both words must contain exactly the same letters the same number of times.

Do not think about code yet. First make sure this meaning is clear.

Complete Answer

Full approach, dry run, Go code, complexity, and mistakes.

The solution is hidden. Use the guided hints first so you still solve the problem yourself.