Member • May 26, 2012
Grouping similar strings in a String array in Java
I am working on a problem wherein I need to Group similar strings in an Array.
i.e If my String array is say "AXPZ","BXT","PZXA","XAZP","XBT","TBX","ABCD"
then I would group AXPZ,PZXA and XAZP in one group.
BXT,XBT and TBX in 2nd group
ABCD in 3rd group.
A group consists of String having same characters (order does not matter)
1)What would be the best approach for the problem.
2) What would be the final DataStructure representing groups and Simillar Strings.
3)What should be the approach for this problem.
If anyone has worked on similar problem do provide some comments or ways to approach it.
Regards,
Ankur Luthra