Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Valid Anagram

Python data engineering interview problem. Difficulty: beginner. Pattern: Hashing. About 10 minutes. Free to practice.

Check whether two strings are anagrams of each other. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement valid_anagram(s: str, t: str) -> bool.

Constraints

  • Case-sensitive.
  • Different lengths cannot be anagrams.

Examples

Input: valid_anagram('anagram', 'nagaram') Output: True Same letters rearranged.

Topics: lakebench, python, anagram, counting.

More Python interview questions · All interview problems · Learn data engineering

beginner

Valid Anagram

Interview-style drill: Check whether two strings are anagrams of each other.

Implement `valid_anagram(s: str, t: str) -> bool`. Example: `"anagram", "nagaram"` → `True`. Keep the harness.