is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
javacode:
- jing547789635 October 15, 2013public class MatchStr {
public static void main(String[] args) {
// String s1 = "a*abc";
// String s2 = "abc";
// String s1 = "a*a*a";
// String s2 = "a";
// String s1 = "a.";
// String s2 = "ab";
// String s1 = "a*bd*c";
// String s2 = "abdc";
String s1 = "ada*d*a";
String s2 = "ada";
System.out.println(isMatch(s1,s2,0,0));
}
public static boolean isMatch(String s1,String s2,int n1,int n2){
int l1 = s1.length();
int l2 = s2.length();
System.out.println("n1:"+n1+"-----n2:"+n2);
if(n1 > l1 || n2 > l2 ){
return false;
}else if(n1 == l1 && n2 == l2){
return true;
}else{
if(n2 < l2 && n1 < l1 && ((s1.charAt(n1) == s2.charAt(n2)) || s1.charAt(n1) == '.')){
return isMatch( s1, s2, n1+1, n2+1);
}else if( n1 < l1 && s1.charAt(n1) == '*'){
if(n2>0){
return isMatch( s1, s2, n1+1, n2-1) || isMatch( s1, s2, n1+1, n2);
}else{
return isMatch( s1, s2, n1+1, n2);
}
}else{
if(n1+1 < l1 && s1.charAt(n1+1) == '*'){
return isMatch( s1, s2, n1+2, n2);
}else{
return false;
}
}
}
}
}