PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency in string manipulation, character frequency analysis, and asymptotic time/space complexity reasoning. It is commonly asked in the coding & algorithms domain to test practical application of basic data structures (string processing and frequency-based counting), correctness under input constraints, and the ability to design efficient, linear-time solutions rather than purely conceptual reasoning.

  • easy
  • Pilot
  • Coding & Algorithms
  • Software Engineer

Solve Anagram Without Sorting

Company: Pilot

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Given two strings `s` and `t`, return `true` if `t` is an anagram of `s`, and `false` otherwise. You may **not** sort either string. An anagram uses exactly the same characters with the same frequencies, but possibly in a different order. Assume both strings contain only lowercase English letters. Examples: - `s = "listen"`, `t = "silent"` -> `true` - `s = "rat"`, `t = "car"` -> `false` Can you solve this in linear time using a hash table or frequency-count approach?

Quick Answer: This question evaluates proficiency in string manipulation, character frequency analysis, and asymptotic time/space complexity reasoning. It is commonly asked in the coding & algorithms domain to test practical application of basic data structures (string processing and frequency-based counting), correctness under input constraints, and the ability to design efficient, linear-time solutions rather than purely conceptual reasoning.

Return whether two lowercase strings are anagrams using character counts, not sorting.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ('listen','silent')

Expected Output: True

Explanation: Anagrams have equal counts.

Input: ('rat','car')

Expected Output: False

Explanation: Different counts.

Input: ('aabb','baba')

Expected Output: True

Explanation: Repeated letters are counted.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.