FastPrepAre All Words Anagrams?
Problems/Are All Words Anagrams?

Are All Words Anagrams?

DocuSign logoDocuSign● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A report from May 2020 listed three questions from one hiring process. One was an anagram check on a group of words. The report does not say which step it came in.

It gives no input format, letter rules or limits. Here you get a list of 1 to 1000 lowercase words of up to 50 letters, and you say whether every pair is an anagram. Letter counts must match. The same word twice counts as anagrams. A single word gives true. We wrote the examples.

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

For each of the 26 lowercase letters, count how often it appears in a word. Two words are anagrams when all 26 counts agree. For example, "note" and "tone" are anagrams (one each of e, n, o, t), while "too" and "to" are not (two os against one).

You are given a list words. Return true if every pair of words in the list are anagrams of each other. Otherwise return false.

  • Repeats are allowed: a word and an exact copy of it have the same counts, so the pair passes.
  • A list with one word gives true.

Function

allAnagrams(words: String[]) → boolean

Examples

Example 1

words = ["stale","least","slate","tales"]return = true

Every word uses the letters a, e, l, s, t once each. So any word can be rearranged into any other, and the answer is true.

Example 2

words = ["races","cares","scare","acres","crate"]return = false

The first four words each use the letters a, c, e, r, s once. "crate" has a t where the others have an s. So not every pair is an anagram, and the answer is false.

Example 3

words = ["deed","dede","dded"]return = false

All three words have 4 letters and use only d and e. "deed" and "dede" each have two ds and two es, but "dded" has three ds and one e. The counts differ, so the answer is false.

Constraints

  • 1 <= words.length <= 1000
  • 1 <= words[i].length <= 50
  • Every words[i] contains only lowercase English letters.

More DocuSign Online Assessment questions

  • Max Sum With No Two Adjacent PicksOA · Seen Apr 2026
  • Max Sum With No Two Adjacent Picks on a CircleOA · Seen Apr 2026
  • Beautiful Number OrderingsOA · Seen Feb 2026
  • Grid Path With the Most ClearanceOA · Seen May 2025
  • Vehicle Mixes for a Wheel TotalOA · Seen May 2025
  • Count Sales Rung Up at the Wrong PriceOA · Seen Feb 2021
  • Most Disjoint Intervals From Starts and DurationsOA · Seen Feb 2021
  • Fewest Fountains to Water the GardenOA · Seen Feb 2021
  • Lowest Start That Keeps Running Totals PositiveOA · Seen Feb 2021
  • Fewest Student Groups Within a Level GapOA · Seen Nov 2020

Similar questions at other companies

  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • Count Repeated Request IDs (Data Science OA)McKinsey & Company · OAMcKinsey & Company interview questions
  • Flat JSON Value DifferencesChubb · OAChubb interview questions
  • Get Search ResultsJP Morgan Chase · OAJP Morgan Chase interview questions
  • Lexicographic Word FrequenciesUpstart · OAUpstart interview questions
  • Email Log Processing, Grouping, and SortingStripe · OAStripe interview questions
  • Most Frequent CharacterMicrosoft · OAMicrosoft interview questions
  • Get Maximum Information GainAmazon · OA
  • Better CompressionGoldman Sachs · OAGoldman Sachs interview questions

Interview reports that mention this question

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

DocuSign interview experiences

  • DocuSign SWE Intern OA Questions: 53 Experiences (Part 1 of 2)
All DocuSign interview questionsSee DocuSign hiring insights
Saved
class Solution {
    public boolean allAnagrams(String[] words) {
        // Write your code here.
    }
}
Checking account…