yeswanth.devisetty
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
public class SubStringChecker {
int count = 0;
public static void main(String[] args) {
SubStringChecker ssc = new SubStringChecker();
ssc.go();
}
public void go(){
String s1s = "asdbqasdhvasdfasd";
String s2s = "asd";
char[] s1 = s1s.toCharArray();
char[] s2 = s2s.toCharArray();
int length = s2.length;
for(int i=0; i<s1.length; i++){
if(s1[i] == s2[0] && i+length<=s1.length){
if(s1s.substring(i, i + length).equals(s2s)){
count++;
}
}
}
System.out.print(count);
}
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
what happens when a char is XORed with 0?
referring to 10th line of your code.
Comment hidden because of low score. Click to expand.
0
of 0 vote
Did the interviewer put a constraint on the complexity?
- yeswanth.devisetty April 17, 2012Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- yeswanth.devisetty April 17, 2012