Box Interview Question
26 Interview Reviews |
Back to all Box Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Senior Software Engineer at Box:
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Anonymous:
Simply pass in a boolean array that determines which letter of the string have been used and which haven't:
permuteStrings(String x, int currentIndex, boolean[] isUsed, char[] originalString) {
if (currentIndex == originalString.length) {
System.out.println(x);
}
else {
for (int i = 0; i < originalString.length; i++) {
if (isUsed[i]) {
continue;
} else {
isUsed[i] = true;
permuteStrings(new String(x.append(originalString[i])), currentIndex++, isUsed, originalString);
isUsed[i] = false;
}
}
}
}