Engineering Intern Interview Questions | Glassdoor

# Engineering Intern Interview Questions

1,942

Engineering intern interview questions shared by candidates

## Top Interview Questions

Sort: Relevance Popular Date

Jan 6, 2011

Nov 8, 2010

### Software Development Engineer Intern at Amazon was asked...

Jan 25, 2011
 Write a function that takes in an array and repeats an integer that appears the most. 5 Answers if: Array [2][2][3][3][3][2][1][2][1] it should print [3] Confusing. In your example, 2 appears the most. Do you mean the integer that repeats the most consecutively? Cause that would be 3. Anyways, in either case, you can go through the array adding all the key-value pairs (number and times) to a hashmap and then access the hashmap in constant time. O(n). class FindMostOccurences { public static DictionaryEntry MostOccurences(int[] Array) { Hashtable ht = new Hashtable(); for (int i = 0; i Int32.Parse(de.Value.ToString())) { { de.Key = item.Key; de.Value = item.Value; } } } return de; } } Show More Responses Using map , i think one loop is sufficient. private static int mostReapeatingNumber(int[] is) { HashMap map = new HashMap(); int tempHighestCount = 0; int keyHighest = 0; for (int index=0; index tempHighestCount) { tempHighestCount = numCount; keyHighest = number; } } } return keyHighest; } I think there's no need to have a map. Just maintain variables prev_max_run, prev_max_num, prev_num, curr_num and curr_run. In the loop if the prev_num was equal to curr_num increment curr_run. When you find the num is different check curr_run with prev_run. If curr_run > prev_run, prev_max_num = curr_num.

Mar 31, 2012
 Implement integer division without using / or %. Questions about running time. Can you do it faster? 6 Answers Optimal running time: O(log n) Binary search Here's an implementation that works -- any ideas on how to make it go faster? public static void divide_without_slash_or_mod(int num, int divisor) { int factor = 0; int remainder = num; System.out.println("Number = " + num + " divisor = " + divisor); while(remainder >= divisor) { remainder -= divisor; factor++; } System.out.println(" remainder = " + remainder + " factor = " + factor ); } Show More Responses Here's an implementation that works -- any ideas on how to make it go faster? public static void divide_without_slash_or_mod(int num, int divisor) { int factor = 0; int remainder = num; System.out.println("Number = " + num + " divisor = " + divisor); while(remainder >= divisor) { remainder -= divisor; factor++; } System.out.println(" remainder = " + remainder + " factor = " + factor ); } D(Divisor), N(Divident) low = 0, high = INT_MAX/D while(low N) high = mid - 1; else low = mid + 1; } return -1; //No divisor Here is the Java implementation of implementing division with O(log n) time complexity (actually, this solution is using divide operator). public static void divide(int dividend, int divisor) { int mid, low = 0, high = Integer.MAX_VALUE / divisor; while(low dividend) { high = mid-1; } else { low = mid +1; } } }

### QA Engineer Intern at Palantir Technologies was asked...

Apr 14, 2012

Feb 23, 2012
 Print out a binary tree level by level 6 Answers Run breadth-first search using a queue. Add a null pointer to signify the end of each level. Are questions really this easy? No. That was my question for the first round. Second round questions are harder. At most companies, engineers interview recruits. So the difficulty of the question depends on which engineer is interviewing you. Show More Responses But whether they hire you or not depends on whether you are from an Ivy league university, right? Are you from one? ^ Yes you're right. Serious Comment: There is usually a large alumni base from the target schools, some of these target schools are ivies. Troll Comment: Yes. If you don't go to an ivy, you don't get hired. Tough luck. I'm not from an ivy league and I hold hired. But I've also started 2 companies with several clients, etc. You just have to be proactive.

### Software Engineer Intern at PayPal was asked...

Apr 25, 2012
 n= 20 for (i=0;i

Apr 16, 2012

### Software Engineering Intern at Palantir Technologies was asked...

Apr 16, 2012
 Say you have a single-column table of entries of variable size. Implement this table to also contain methods to lengthen one cell, cut a cell shorter, and to return which cell we're pointing at if given a certain distance from the beginning of the table. All methods need to be fast (assume a single-column table with many many entries). 6 Answers One way to do this is to use the doubly linked list. Assuming lengthening and cutting short a cell happens only at the end of the table, then both operations can be done easily and quickly on a D.L.List. Not sure what the interviewer meant by distance from beginning of the table... like number of bytes from the beginning of the table and he wants the cell number? For example, if each cell has length 5, and the user clicks on 13 from the top, then you need to let the user know he has clicked on cell 3. This operation needs to be fast. The search function needs to be doable in less than linear time, and so do inserts and deletes Show More Responses binary indexed trees link list of link lists An dynamically allocated array that can be resized..