akash.bhunchal
BAN USER
Comments (4)
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
note sure abt the question but you could always create a list of objects in one iteration (as space complexity is not an issue), then print the list in reverse.... not sure if we understand the question.
- akash.bhunchal January 10, 2012Comment hidden because of low score. Click to expand.
0
of 0 vote
in java
static void findIntersection(String a, String b){
List<Character> inter = new ArrayList<Character>();
for(int i=0; i< a.length();i++){
if(b.indexOf(a.charAt(i)) > -1){
if(!inter.contains(a.charAt(i)))
inter.add(a.charAt(i));
}
}
for(Character c: inter)
System.out.println(c);
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
damnn .. fails for the example I took ... please ignore
- akash.bhunchal December 11, 2011Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
it said " without using 2 for loops". :) ... might be a typo ...
- akash.bhunchal January 11, 2012