Epic Systems Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
1
of 1 vote

def main():
    string = '''epic is a healthcare company.\ninterviewing for software developer.\nprint this vertically sentence by sentence.'''
    strLisr = string.split('\n')

    li = [list(x) for x in strLisr]
    #print(li)

    lenList = []
    for w in li:
        lenList.append(len(w))
    #print(lenList)
    lenList = sorted(lenList)[:]
    #print(lenList)
    minLength = lenList[0]
    maxLength = lenList[len(lenList)-1]

    #print(maxLength, ' ' , minLength)

    for row in range(len(li)):
        for col in range(len((li[row]))):
            print(li[row][col], end=' ')
        print()

    index = 0
    while index<len(lenList):
        minLength = lenList[index]
        for col in range(minLength):
            for row in range(len((li))):
                if(len(li[row])<minLength):
                    print(' ', end='  ')
                else:
                    print(li[row][col], end='  ')
            print()
        index+=1



if __name__=='__main__':
    main()

- SB March 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Java Code
public static void main(String[] args) {
String string="epic is a healthcare company";
printVertical(string);
}
public static void printVertical(String input){
Queue<String> stringQueue=new LinkedList<String>();
String [] string=input.split(" ");
for (int i = 0; i <string.length ; i++) {
stringQueue.add(string[i]);
}
for (int i = 0; i <string.length ; i++) {
String stringPrint=stringQueue.poll();
System.out.printf("%s\n",stringPrint);
}

- Tony March 28, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

public void convertHorizontalStringToVertical(String[] strArr) {
        int max = 0;
        for (int i = 1; i < strArr.length; i++) {
            int temp = strArr[i].split(" ").length;
            if (max < temp) {
                max = temp;
            }
        }

        String[][] output = new String[max][strArr.length];

        for (int i = 0; i < strArr.length; i++) {
            String[] temp = strArr[i].split(" ");
            for (int j = 0; j < max; j++) {
                if (j < temp.length) {
                    output[j][i] = temp[j];
                } else {
                    output[j][i] = " ";
                }
            }
        }

        for (int i = 0; i < output.length; i++) {
            System.out.println(Arrays.toString(output[i]));
        }
    }

Output:
[epic, interviewing, print]
[is, for, this]
[a, software, vertically]
[healthcare, developer, sentence]
[company.,  , by]
[ ,  , sentence.]

- Scorpion King April 03, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We know that we will have encountered a sentence by the time we have reached a period in a string. So, what we can do is create a queue, enqueue all strings until a period is reached. Then we create a new queue and repeat the process. There should be one queue for each sentence. Finally, starting from the first queue until the last queue, dequeue and print, then start from the first queue again until the last queue- dequeue and print. Continue this process until all queues are empty

- Skor March 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Make sure to handle the cases where earlier strings are shorter than later strings. This means you need to left-pad later strings with spaces to align their output appropriately.

- JW March 18, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@JW Well for that we only need to keep track of the size of longest string in each queue thereby making it possible to hndle the situation which you outlined

- deepanshu29 March 18, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More