I wrote a simple program to remove duplicates from a String without using additional buffer. The program should filter the duplicates and return just the unique string. Example: Input: FOLW UP I just want to know if the below solution is a good solution for my problem statement. public class compareString { public static void main(String args[]) { removeDuplicateString("FOOOOOOOOLLLLLOWWWWWWWWWW UUUUP"); } public static void removeDuplicateString(String input) { String value1 = input; String value2 = input; String finalValue = ""; int count = 0; char char1; char char2 = 0; for (int i = 0;
Read full article from java - Remove duplicates from string without using additional buffer - Code Review Stack Exchange
No comments:
Post a Comment