asked 26.9k views
5 votes
How to find duplicate characters in a string in java.

asked
User Rytis I
by
7.6k points

1 Answer

10 votes

Answer:

Find duplicate characters in string

1. Split the string into character array.

2. Iterate over character array.

3. For each iteration, use character as map key and check is same character is present in map, already.

4. If map key does not exist it means the character has been encountered first time.

Step-by-step explanation:

I'm just intelligent in that area of java

answered
User Greg Leaver
by
7.7k points