amit
BAN USER
Forum Posts (1)
Comments (3)
Reputation 30
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
import java.util.Arrays;
class MissingCharInString {
public static void main(String[] args) {
String s;
s = "acbfd";
char c[] = s.toLowerCase().toCharArray();
Arrays.sort(c);
int a = (int) c[0];
for (int i = 0; i <= c.length - 1; i++) {
while ((int) c[i] != a++) {
System.out.println((char) (a - 1));
}
}
}
}
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
import java.util.Arrays;
- amit July 13, 2016class MissingCharInString {
public static void main(String[] args) {
String s;
s = "acbfdh";
char c[] = s.toLowerCase().toCharArray();
Arrays.sort(c);
int a = (int) c[0];
for (int i = 0; i <= c.length - 1; i++) {
while ((int) c[i] != a++) {
System.out.println((char) (a - 1));
}
}
}
}