Addition of characters using string biuilder TC=O(26) or O(n)
class addchar{
public static void main(String[] args) {
StringBuilder str=new StringBuilder("udit");
for(char ch='a';ch<='z';ch++){
str.append(ch);
}
System.out.println(str);
}
}
Comments
Post a Comment