FastPrepCheck Anagram Pairs Index by Index
Problems/Check Anagram Pairs Index by Index

Check Anagram Pairs Index by Index

Expedia logoExpedia● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A 2025 Expedia software engineering intern candidate, interviewed when Expedia visited their campus, got this in the second of two interviews held there. The report gives the task only a short title and a link to a public Q&A question. In that question, two equal-size lists are paired up by position, and each pair gets 1 when its words are anagrams and 0 when they are not.

Here, those 1 and 0 values come back as an array. The report gives no examples or limits, so these are our choices: a word counts as an anagram of itself, words use only lowercase English letters, and each list holds up to 2000 words of up to 100 letters.

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

You are given two lists of words, first and second, with the same number of words.

For every index i, check whether first[i] and second[i] are anagrams: two words are anagrams when one can be turned into the other by reordering its letters, so they use exactly the same letters the same number of times. A word is an anagram of itself.

Return an array result of the same length, where result[i] is 1 if first[i] and second[i] are anagrams and 0 otherwise. Only words at the same index are compared.

Function

checkAnagramPairs(first: String[], second: String[]) → int[]

Examples

Example 1

first = ["stone","night","cat","banana"]second = ["notes","think","act","bananas"]return = [1,0,1,0]

"stone" and "notes" use the same five letters, so the first result is 1. "night" has a 'g' and "think" has a 'k' instead, so the second result is 0. "cat" and "act" match, so the third result is 1. "banana" has 6 letters and "bananas" has 7, so the last result is 0.

Example 2

first = ["aab","abc"]second = ["abb","cab"]return = [0,1]

"aab" and "abb" use the same kinds of letters, but "aab" has two 'a's and "abb" has only one, so they are not anagrams. "abc" and "cab" are anagrams.

Example 3

first = ["ab","ba"]second = ["ab","cd"]return = [1,0]

A word is an anagram of itself, so "ab" and "ab" give 1. "ba" is compared only with "cd", the word at the same index, so the second result is 0, even though "ba" is an anagram of "ab" at index 0.

Constraints

  • 1 <= first.length == second.length <= 2000
  • 1 <= first[i].length, second[i].length <= 100
  • Every word contains only lowercase English letters.

More Expedia Onsite Interview questions

  • Scramble StringONSITE INTERVIEW · Seen Sep 2026
  • Smallest Sufficient TeamONSITE INTERVIEW · Seen Sep 2026
  • Fresh Oranges Left After Rotting StopsONSITE INTERVIEW · Seen Oct 2025
  • Longest Increasing SubsequenceONSITE INTERVIEW · Seen Oct 2025
  • Lowest Common Ancestor with Repeated and Missing ValuesONSITE INTERVIEW · Seen Oct 2025
  • Shortest Substring with Exactly K OnesONSITE INTERVIEW · Seen Oct 2025
  • Middle Element of a Linked ListONSITE INTERVIEW · Seen Nov 2024
  • Minimum in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Sep 2024
  • Mirror Image Binary TreesONSITE INTERVIEW · Seen Sep 2024
  • Maximum Supplier ProfitONSITE INTERVIEW · Seen Aug 2024

Similar questions at other companies

  • Count Adjacent Symbol Pairs for BPEAmazon · ONSITE INTERVIEW
  • Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions
  • Filter Anagrams of a TargetMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Deduplicate Logs: Keep FirstGoogle · ONSITE INTERVIEWGoogle interview questions
  • Check AnagramsDeloitte · ONSITE INTERVIEWDeloitte interview questions
  • Check AnagramsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Recursive Character FrequencyPalo Alto Networks · ONSITE INTERVIEWPalo Alto Networks interview questions
  • Valid AnagramMotive · ONSITE INTERVIEWMotive interview questions
  • Anagram Words in a SentenceNutanix · ONSITE INTERVIEWNutanix interview questions
  • List Each Name Once, AlphabeticallyDocuSign · ONSITE INTERVIEWDocuSign interview questions

Interview reports that mention this question

  • Expedia SWE Intern Final Round: 126 Experiences (Part 1 of 6)

Expedia interview experiences

  • Expedia Intern Final Round in 2021: 28 Experiences (Part 4 of 6)
  • Expedia Intern Finals Before 2020: 14 Experiences (Part 6 of 6)
  • Expedia Intern Final Round in 2020: 24 Experiences (Part 5 of 6)
  • Expedia Intern Final Round in 2022: 15 Experiences (Part 3 of 6)
  • Expedia Intern Final Round in 2023: 17 Experiences (Part 2 of 6)
All Expedia interview questionsSee Expedia hiring insights
Saved
class Solution {
    public int[] checkAnagramPairs(String[] first, String[] second) {
        // Write your code here.
    }
}
Checking account…