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.
import java.util.ArrayList;
- Bhagrav June 01, 2014import java.util.List;
public class Replaceby0and1 {
public static void main(String[] args) {
String test = "a?b?ab?";
List<String> replacedStrings = replace(test);
for (String temp : replacedStrings) {
System.out.println(temp);
}
}
private static List<String> replace(String test) {
List<String> replacedStrings = new ArrayList<>();
if (test.indexOf('?') == -1) {
replacedStrings.add(test);
return replacedStrings;
} else {
if (test.length() == 0) {
replacedStrings.add(test);
return replacedStrings;
} else if (test.length() == 1) {
if (test.equals("?")) {
replacedStrings.add("0");
replacedStrings.add("1");
} else {
replacedStrings.add(test);
}
return replacedStrings;
} else {
List<String> replacedSubStrings = new ArrayList<>();
replacedSubStrings = replace(test.substring(1, test.length()));
if (test.charAt(0) == '?') {
for (String temp : replacedSubStrings) {
replacedStrings.add('0' + temp);
replacedStrings.add('1' + temp);
}
} else {
for (String temp : replacedSubStrings) {
replacedStrings.add(test.charAt(0) + temp);
}
}
return replacedStrings;
}
}
}
}