Interview Interview Questions | Glassdoor

# Interview Interview Questions

479

interview questions shared by candidates

## Interview Interview Questions

Sort: Relevance Popular Date

### State Property Manager at US Bureau of Land Management was asked...

Aug 12, 2011
 How would you address a circumstance in which you disagree with your supervisor's decision or actions in a particular instance? 1 Answer I responded that my responsibility is to provide my supervisor with sufficient info for her to make a good decision and ultimately I have to trust she is going to do just that, she won't ask me to do anything unlawful, and as she has the overall responsibility, I will need to accept her decision and move on with business to support her decision.

### IOS Developer at Copper Mobile was asked...

Apr 8, 2012
 What is iphone reference library? 1 Answer iPhone reference library is a set of reference documents for iPhone OS.

### Cabin Crew at Emirates was asked...

May 18, 2014
 Why do you want be Flight Attendant? 1 Answer The reason is because I am a team player, love to interact with different people from all over and love to travel.

### Software Developer Position at RockYou was asked...

Feb 10, 2010

Aug 1, 2013
 Consider an X x Y array of 1's and 0s. The X axis represents "influences" meaning that X influences Y. So, for example, if \$array[3,7] is 1 that means that 3 influences 7. An "influencer" is someone who influences every other person, but is not influenced by any other member. Given such an array, write a function to determine whether or not an "influencer" exists in the array. 12 Answers This was a tough one that forces you to consider how best to traverse the array and eliminate possibilities as soon as possible. Not_Influencers[n] = 0; //Make all elements 0 for (i = 0 ; i< n ; i++){ if(Not_Influencers[i] == 1) continue; row_sum = find_row_sum(a[i]); if(row_sum == n-1 && find_col_sum(i) == 0) return Found; for(j = i; j < i; j++) if (a[j] == 1) Not_Influencers[j] = 1; } X should be equal to Y, right? Show More Responses //if vec[i][j] == 0 then i is not an influence //if vec[i][j] == 1 then j is not an influence //so time complexity is O(n) bool find_influences(vector > &vec) { int n = vec.size(); vector not_influence(n); for (int i = 0; i = 0; --j) { if (!vec[i][j]) { break; } not_influence[j] = 1; } if (j < 0) { return true; } } not_influence[i] = 1; } return false; } Run a BFS or DFS. For each node keep going to influencer. Find a node which can be reach by all nodes. Sort of finding sink node. public static int influencer(final int[][] jobs, final int r, final int c) { int[] degree_in = new int[jobs.length]; int[] degree_out = new int[jobs.length]; for (int i = 0; i < r; ++i) { for (int j = 0; j < c; ++j) { if(jobs[i][j] == 1) { // i influences j degree_out[i]++; degree_in[j]++; } } } for (int i = 0; i < r; ++i) { if (degree_out[i] == r - 1 && degree_in[i] == 0) { return i; } } return -1; } Consider the input as Graph given in adjaceny matrix representation. Find whether a semi-eulerian path is present in the graph or not. Take the XOR product of the original matrix with the transposed matrix and sum by row. If any row counts equal the rank then they are influencers. private static boolean hasInfluencer(int[][] matrix) { if (matrix == null) return false; if (matrix.length == 0) return false; boolean result = false; for (int i=0; i the XOR suggestion I think is incomplete. The condition sum(row_influencer) = 1 and sum(column_influencer) = N so a simple matrix multiplication with the transposed should give for the vector v[influencer] = N and v[N-influencer] = 1. I assume influencer influences himself. def find_influencer(matrix): for row in range(len(matrix)): following_none = not any(matrix[row]) if not following_none: continue all_following = True for r_no in range(len(matrix)): if not row == r_no: continue if not matrix[r_no][row]: all_following = False break if all_following: return row return -1 Here is a different view. Please comment if you find any issues with the logic. 1st. condition: An influencer can not be influenced by any one. Let's say the in a matrix of [x.y], there is an influencer with index 2. So, the column=2 (3rd column) in the matrix must be all 0s, since the influencer can not be influenced. Step 1: Find a column with all 0s. If found, remember the column index or there is no influencer. Let's say, it is m Second condition: An influencer must have influenced everyone. So, in our example: row=2 (third row) must be all 1s except for column=2, since influencer can not even influence self. Step 2: Check row=m and find that all values are 1 except for [m][m]. If found, we have an influencer.

### Technical Program Manager at Amazon was asked...

Jul 9, 2011
 Given a string like "I'm being interviewed by Amazon" implement a method that reverses the given string so that it looks like "Amazon by interviewed being I'm". 8 Answers In java: String str = "I'm being interviewed by Amazon"; String pieces[] = foo.split(); String reversedFoo; for (int i = pieces.length - 1; i >= 0; i--) { reversedFoo += pieces[i]; if (i > 0) reversedFoo += " "; } System.out.println(reversedFoo); we can first reverse the whole string, and then reverse the individual words O(n) complexity /** * Jun Zheng, Rice Univ * An interview question of Amazon * Java 7, Eclipse * Reverse a sentence, e.g., "Amazon is so gay" to "gay so is Amazon" * @param str * @return */ private String reverseSentence(String str){ str=new StringBuffer(str).reverse().toString(); int j=0; for(int i=0;i

### Technical Program Manager at Amazon was asked...

Jul 9, 2011
 Given two arrays find all the points of intersection between the (i.e. equal elements) and return them in an array. 4 Answers couple of solutions - sort the array (nlogn) complexity - browse with the smaller array and visit each of the bigger array and return if there is a match. Complexity (n square) thus not a good solution next solution - sort the arrays and remove duplicates (nlogn) - create a table, with the longer array - browse to the smaller array and update the count - use a hashtable. O(n). traverse first array: O(n) put elements into hashtable: O(1) traverse through second array: O(m) check for existence of element in hashtable: O(1) if yes, add to resultant array. return resultant array So, final time complexity is O(n) Show More Responses def intersect(a1, a2): return [x for x in a1 if x in a2] One-liner in Python

### Front End Cashier at Walmart was asked...

Aug 27, 2012
 Name a problem you had with a supervisor or teacher. What happened and how did you overcome it? 2 Answers I've never had a problem with a supervisor or teacher. My college history teacher taught in a largely lecture oriented way. We didn't have many assignments that would let us and the teacher know if we understood the material. I had a meeting with him after class one day and asked him if their were any ways I could check to make sure if i understood the material. He told me anytime I believed i didnt understand a topic just to speak with him shortly about it after class.