Remove duplicate characters from the given string. “Wikipedia”–>>”wkpeda”

  Kiến thức lập trình

I want a output from “Wikipedia” to Wkpeda..remove the duplicate characters in the given string.

public class Problem1 {
public static void removeDuplicate(String s) {

    for(int i=0;i<s.length();i++) {
        for(int j=i+1;j<s.length();j++) {
            if(s.charAt(i)==s.charAt(j)) {
                
            }
        }
        
    }
}

public static void main(String[] args) {
    String s= "Wikipedia";
    removeDuplicate(s);

}

}

New contributor

Goutham BJ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT