Epic Systems Interview Question
SDE1sCountry: United States
Interview Type: Written Test
package dashboard;
import java.util.ArrayList;
public class practice {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "Hi, Whatsup? What are you doing? excess audible eating";
String[] strArr = str.split(" "); //split by spaces
ArrayList<Character> vowelList = new ArrayList<Character>();
vowelList.add('a');
vowelList.add('e');
vowelList.add('i');
vowelList.add('o');
vowelList.add('u');
int conWordPos = 0;
for(int i=0; i<strArr.length; i++){
if(vowelList.contains(strArr[i].charAt(0))){
String temp = strArr[i];
strArr[i] = strArr[conWordPos];
strArr[conWordPos] = temp;
conWordPos++;
}
}
for(int i=0; i<strArr.length; i++){
System.out.println(strArr[i]);
}
}
}
- Vir Pratap Uttam April 17, 2015