GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Ask a Question

 

Start Coding Today

   

GeeksQuiz

GeeksforGeeksIDE

Data Structures

Algorithms

Interview Experiences

C Programming

C++ Programming

Java Programming

GATE CS

Books

Google Interview :- How many distinct names are there in total ??

Given an array on 'N' names (Strings) , you have to find how many distinct name are there in total.

Details of name are described below:

  • Each name is a string of char from a to z (small letters).
  • Two names , say name1 and name2 , are said to be same if name2 can be obtained by swapping the iᵗʰ character with the jᵗʰ character in name1 where (i+j)%2=0.

Input1 : N (Size of Array)

Input2 : Array of strings containing the name of N users.

Output : return T, Total number of distinct name.

Example:

Input : 2, { abcd,cdab }

 

asked Mar 3 by nish
edited Mar 3 by nish
...