sbharathind
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
why cant we make a two dimensional array and use distance formula between two co ordinates x1,y1 to x2,y2 as root((x2-x1)^2+(y2-y1)^2) to find ?
- sbharathind February 06, 2013Comment hidden because of low score. Click to expand.
0
of 0 vote
Hi why not store string 2 in a char array and use .contains property of arraylist.
My code for the question is below. Please whether the code is Fine or is it not correct way to Implement
String s1="AMAZON";
String s2="AND";
String s3 = "";
Character c;
ArrayList al=new ArrayList();
for(int i=0;i<s2.length();i++)
al.add(s2.charAt(i));
for(int i=0;i<s1.length();i++)
{
c=s1.charAt(i);
if(!al.contains(c))
s3+=c;
}
System.out.println("Output is"+s3);
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Please tell me whether this solution is good or not ? And what are its disadvantages ?
- sbharathind February 11, 2013