FastPrepAre Two Strings Anagrams
Problems/Are Two Strings Anagrams

Are Two Strings Anagrams

Adobe logoAdobe● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You decide whether one string is a rearrangement of another, with each letter used the same number of times. A report from a fresher who interviewed for an SDE intern role at Adobe (a single 50-minute video round on 12 October 2022, rejected) lists a permutation test on a pair of strings among the round's five items. The round also had a coin puzzle, a tree diameter task, a peak search and a ticket-booking design question. Under that item the report keeps the title, a short summary and the author's own code. The code tallies each character in a table of 256 counters. It gives no limits or examples of its own.

We chose these rules. Both strings use lowercase English letters only. Each has 1 to 2 * 10^4 characters. The lengths may differ. We wrote new examples.

Our version is about 90% the same as the reported question.

You are given two strings s and t. Return true if t is an anagram of s, and false otherwise.

t is an anagram of s when it is a rearrangement of the same letters: every letter appears in t exactly as many times as it appears in s. The two strings may have different lengths.

Function

areAnagrams(s: String, t: String) → boolean

Examples

Example 1

s = "adobe"t = "abode"return = true

Both words use one each of a, b, d, e and o, only in a different order. The answer is true.

Example 2

s = "aabbc"t = "abbcc"return = false

Both strings have 5 letters drawn from a, b and c, but s has two as and one c while t has one a and two cs. The counts differ, so the answer is false.

Example 3

s = "crop"t = "crops"return = false

The lengths differ (4 and 5), so t has a letter that s lacks. The answer is false.

Constraints

  • 1 <= s.length, t.length <= 2 * 10^4
  • s and t contain only lowercase English letters

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • Best Anagram MatchGoogle · PHONE SCREENGoogle interview questions
  • Word Frequency in a Large TextRobinhood · PHONE SCREENRobinhood interview questions
  • Remove Later Anagrams From a ListBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Employees With Shared InterestsPalantir · PHONE SCREENPalantir interview questions
  • Rank Words by FrequencyDatadog · PHONE SCREENDatadog interview questions
  • Sort Letters by FrequencyScale AI · PHONE SCREENScale AI interview questions

Interview reports that mention this question

  • Adobe SWE Intern Interviews: 27 Experiences (Part 2 of 4)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public boolean areAnagrams(String s, String t) {
        // Write your code here.
    }
}
Checking account…