Aman Raj
BAN USER
Comments (4)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
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.Scanner;
import java.util.Arrays;
class MissingString
{
public static void main(String[] args)
{
String s;
Scanner x=new Scanner(System.in);
System.out.println("enter the string");
s=x.nextLine();
char c[]=s.toLowerCase().toCharArray();
Arrays.sort(c);
int t=0;
for(int i=1;i<=c.length-1;i++)
{
t=(int)c[i]-(int)c[i-1];
int l=(int)c[i]-1;
while(t>1)
{
System.out.println((char)l--);
t--;
}
}
}
}
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.
this solution will have <o(n) time complexity.
- Aman Raj March 14, 2014