1.

What will be the output of the code that generates permutations and also has the ability to handle duplicates, for the input str[]=”AA”?(a) AA(b) AA,AA(c) A,A(d) AThis question was addressed to me in an international level competition.I'm obligated to ask this question of Number Theory topic in portion Number Theory of Data Structures & Algorithms II

Answer»

Correct choice is (a) AA

Easy EXPLANATION - If a CODE is able to HANDLE duplicates then the two A’s are not CONSIDERED to be different elements DUE to which only one permutation will be formed. So the output will be AA only.



Discussion

No Comment Found

Related InterviewSolutions