Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Check Anagram in Distributed System?

How can we check the anagram strings pair in the distributed system?

Suppose we have N number of strings in Db(SQL or NoSQL). There are multiple services that are accepting M numbers of the string array. What is the optimized approach for this problem?

Example: Below are 5 Strings in Db: (N = 5)

  1. AAABBBC
  2. BHBH
  3. KLMON
  4. AAAC
  5. CCCA

Below are 3 strings for which we find anagram strings: (M = 3)

  1. BABABAC
  2. CCAC
  3. MONLN

Answer is:

  1. BABABAC ---> BABABAC ---> A3, B3, C1
  2. CCAC ---> CCCA ---> A1, C3
  3. MONLN ---> no anagram found

Comments