here is my program and i want to return in sorting order.
input=42315
output=12345
and here is my program.......
public class Lottery
{
static String str="42135";
int ar[]=new int[20];
int i=0,j=0,k=0;
int temp=0;
public int[] get(int[] p)
{
System.out.print(p[i]);
i++;
if(i==str.length())
for(j=0;j<str.length()-1;j++)
{
for(i=j+1;i<str.length();i++)
if(p[j]<p[i])
{
temp=p[j];
p[j]=p[i];
p[i]=temp;
}
}
//if(j==str.length())
return p;
}
public static void main(String arg[])
{
Lottery ob=new Lottery();
int l=0;
int a[]=new int[5];
int j[]=new int[5];
try
{
for(int i=0;i<a.length;i++)
{
a[i]=str.charAt(i)-'0';
//for(l=0;l<a.length;l++)
j=ob.get(a);
System.out.print(j[l]);
l++;
}
}
catch(Exception e)
{
System.out.println("got excep:"+e);
}
}
}
--
You received this message because you are subscribed to the Google Groups
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.