Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture

Problem: For the words ["bella", "label", "roller", "dinner", "ladder"], how many pairs (i, j) with i < j are anagrams of each other (same letters, same counts)?

  1. A. 2
  2. B. 0
  3. C. 3
  4. D. 1

Correct answer: D. 1

Anagram pairs share a sorted-letter signature. Comparing lengths alone or the first letters gives a wrong pair count.

More Coding Interview Problems questions

Exams that ask this topic