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;
- manteshsb September 13, 2017import java.util.Arrays;
import java.util.List;
public class SortSegmentsOfString {
public static void main(String[] args) {
// TODO Auto-generated method stub
SortSegmentsOfString ss = new SortSegmentsOfString();
String input = "AZQF013452BA432B8534AFCE";
System.out.println("Result string: "+ss.splitString(input));
}
public String splitString(String input)
{
List<String> sortedList = new ArrayList<String>();
boolean isAlpha = false, isNumeric = false;
int startIndex = 0;
for(int i=0;i<input.length();i++)
{
if(input.charAt(i) >='A' && input.charAt(i) <='Z')
{
if(!isAlpha && !isNumeric)
{
isAlpha = true;
}
else if (isNumeric)
{
isNumeric = false;
isAlpha = true;
sortedList.add(sortString(input.substring(startIndex, i)));
startIndex = i;
}
}
else if (input.charAt(i) >='0' && input.charAt(i) <='9')
{
if(!isAlpha && !isNumeric)
{
isNumeric = true;
}
else if (isAlpha)
{
isNumeric = true;
isAlpha = false;
sortedList.add(sortString(input.substring(startIndex, i)));
startIndex = i;
}
}
}
if(startIndex != input.length())
{
sortedList.add(sortString(input.substring(startIndex, input.length())));
}
StringBuilder sb = new StringBuilder();
for(String s: sortedList) {
sb.append(s);
}
return sb.toString();
}
public String sortString(String unsortStr)
{
char[] charArray = unsortStr.toCharArray();
Arrays.sort(charArray);
String sortedString = new String(charArray);
return sortedString;
}
}