# 8 K

Preguntas de entrevista para Engineer Intern compartidas por los candidatos

## Preguntas de entrevista principales

Ordenar: Relevancia|Popular|Fecha
Se le preguntó a Software Engineer Intern…28 de julio de 2009

### Suppose you had eight identical balls. One of them is slightly heavier and you are given a balance scale . What's the fewest number of times you have to use the scale to find the heavier ball?

47 respuestas

Two. Split into three groups of three, three, and two. weigh the two groups of three against each other. If equal, weigh the group of two to find the heavier. If one group of three is heavier pick two of the three and compare them to find the heaviest. Menos

2 3a+3b+2 = 8 if wt(3a)==wt(3b) then compare the remaining 2 to find the heaviest if wt(3a) !== wt(3b) then ignore group of 2 discard lighter group of 3 divide the remaining group of 3 into 2+1 weigh those 2 If == the remaing 1 is the heaviest if !== the heaviest will be on the scale Menos

2 weighings to find the slightly heavier ball. Step 1. compare 2 groups of three balls. Case 1. if they are both equal in weight, compare the last 2 balls - one will be heavier. case 2. If either group of 3 balls is heavier, take 2 balls from the heavier side. compare 1 ball against the 2nd from the heavy group result 1. if one ball is heavier than the other, you have found the slightly heavier ball. result 2. if both balls are equal weight, the 3rd ball is the slightly heavier ball. Easy Shmeezi Menos

Mostrar Más respuestas

### non disclosure agreement

18 respuestas

I don't actually know. I mean, that's what I would do if I were amazon, but I did not read anything about them webcamming me, and I also didn't happen to notice the webcam light being on. That didn't mean it didn't happen, though. Menos

I took the test in c++. The function interfaces were in base c, though, so it would probably look more or less identical in c or java. Menos

Hi, I just finished my second assessment test for Amazon and passed all their tests for the 2 coding questions. Was the second test really the final round? There isn't a final third round? Thanks! Menos

Mostrar Más respuestas

### What was one of your best achievements on a project in the past?

18 respuestas

From what i've heard and seen, just wait, following up will barely do you any good. Menos

Hey, I just have one question out of curiosity, was the second online assessment web-cam proctored? Menos

i heard amazon is changing their recruiting process. Many people complained that the online proctoring was an invasion of their privacy. I also had a second online assessment but it was not webcam proctored. I am assuming the recruiting process is now two online non webcam assessments then a final phone interview. My friend had that round of interviews with Amazon 2 weeks ago. Menos

Mostrar Más respuestas

### DS, Algorithms.

18 respuestas

Review Leetcode, CTCI.

Hi, did you interview on Jan 27? Did the engineer ask about behavioral questions or resume questions or did they just jump right into the coding questions? Also I finished my second assessment a week ago but still didn't get a reply back. Was that normal for you? Menos

Hi, did you interview on Jan 27? Did the engineer ask about behavioral questions or resume questions or did they just jump right into the coding questions? Also I finished my second assessment a week ago but still didn't get a reply back. Was that normal for you? Menos

Mostrar Más respuestas

### Given two strings representing integer numbers ("123" , "30") return a string representing the sum of the two numbers ("153")

14 respuestas

public static String sumStrings(String a, String b){ char[] num1 = a.toCharArray(); char[] num2 = b.toCharArray(); int i = num1.length - 1; int j = num2.length - 1; StringBuilder sumString = new StringBuilder(); int carry = 0; while(i &gt;= 0 || j &gt;= 0){ int d1 = 0; int d2 = 0; if (i &gt;= 0) d1 = num1[i--] - '0'; if (j &gt;= 0) d2 = num2[j--] - '0'; int sum = d1 + d2 + carry; if (sum &gt;= 10){ carry = sum / 10; sum = sum % 10; }else carry = 0; sumString.insert(0, sum); } return sumString.toString(); } Menos

The interviewer wanted a loop through the digits starting form right to left, adding them one by one, and keeping track of the carriage. Menos

public static String addTwoStrings(String s1, String s2) { int len1 = s1.length(); int len2 = s2.length(); char[] s1Chars = s1.toCharArray(); char[] s2Chars = s2.toCharArray(); StringBuilder sb = new StringBuilder(); int pointerA = len1 -1; int pointerB = len2 -1; int carry = 0; while (pointerA &gt;= 0 || pointerB &gt;= 0){ int a = pointerA 10) { carry = sumTemp / 10; sumTemp = sumTemp % 10; } else { carry = 0; } sb.insert(0, sumTemp); } if(carry &gt;0) sb.insert(0, carry); return sb.toString(); } Menos

Mostrar Más respuestas

### Suppose we can translate numbers into characters: 1-&gt;a, 2-&gt;b, ...26-&gt;z given an integer, for example, 11223, output every translation of the number.

13 respuestas

Well I think the first answer in totally wrong except the first one, Here is what I have: aabbc kvc alw kbw aavc aabw kbbc albc Menos

In Java, a recursive solution is: public static void main(String[] args) { String s = "11223"; char[] N = s.toCharArray(); char[] S = new char[N.length]; m(0,0,N,S); } public static void m(int i, int j, char N[], char[] S){ if (i==N.length){ System.out.println(new String(S, 0, j) ); return; } S[j]=(char)('a'+Integer.parseInt(""+N[i])-1); m(i+1, j+1, N, S); if (N[i]=='1' || (N[i]=='2' &amp;&amp; N[i+1]&lt;'7')) { S[j]=(char)('a'+Integer.parseInt(""+N[i]+N[i+1])-1); m(i+2, j+1, N, S); } } Menos

no body use dp?

Mostrar Más respuestas

### To find and return the common node of two linked lists merged into a 'Y' shape.

13 respuestas

For a Y shaped like this: 1 -&gt; 2 -&gt; 3 -&gt; 4 -&gt;7 -&gt; 8 -&gt; 9 5 -&gt; 6 -&gt; 7 -&gt; 8 -&gt; 9 where the trunk portion is of constant length, it is easy. Get the length of the first list. In our case 7. Get the length of the second list: 5. Difference is 2. This has to come from the legs. So, walk the difference in the larger list. Now node1 points to 3. node 2 points to 5. Now, walk through the two lists until the next pointers are the same. Menos

@kvr what if the lists are 1-2-3-4-7-8-9 and 12-13-14-5-6-8-9

i think that kvr's answer is the best. @snv if the two lists are linked by the very last two nodes, then you would find out after you are checking the values of the second two last two nodes. you just got unlucky and basically have to check until the very end. so basically, as a diagram with your example, it would look like this 1 -2 -3 -4-7-8-9 x -x -x -x -x-o 12-13-14-5-6-8-9 (sorry about spacing) but because you know the difference in length is 0, you can start comparing the two lists of nodes one by one. from the very beginning. Menos

Mostrar Más respuestas

### Determine if an array from 1..n has a duplicate in constant time and space.

13 respuestas

If an array has elements from 1 to n the size of the array will be n, thus if the size of the array is greater than n, there must exist a duplicate. Menos

What are the properties of an array that affect time complexity? Usually we're talking about the size of the array, N, such that linear time operations, O(N), are those that perform an operation on each of the elements in the array. However, an important thing to consider is that you can evaluate N (the size of the array) itself in constant time. The only way this can be done in constant time is if the input satisfies the precondition that "1..n" means there are no *missing* values in that range. In other words, such an array from "1..5" must contain at least one instance of the numbers 1, 2, 3, 4, and 5. With that precondition, you know that the length of the array will be 5 if no duplicates and greater than 5 if it does contain duplicates. Menos

SUM(array) - (N(N+1)/2) = missing number.

Mostrar Más respuestas

### If you have a refrigerator in an isolated room (no heat in or out) and left the door to the refrigerator open, what would happen to the temperature to the room? Would it go up, down or say the same?

11 respuestas

The refrigerator will warm up the room. If you look on the back of the refrigerator, you will see metal grating. Touch it. Its warm! A refrigerator is transporting heat from the inside cavity to the outside. However, the power cord running from the wall is pumping energy into the refrigerator/room. Energy is powering the refrigerator. It is also running an irreversible process, the energy dissipates out as heat and work (mostly heat), making the net temperature of the room increase. Menos

In this case, there is a net gain of energy from the refrigerator outlet into the room and no loss of energy out of the room. Thus, the room will warm up since there is a gain of energy. Menos

The temperature and overall heat content of the room will increase. Yes, the fridge it providing cooling, but it is doing this by removing heat from part of the air and dumping it into other parts of the air, all while doing work which is harnessed from the power input (electricity) from the wall. In other words, the heat in the air is just displaced from one area of air to another, so no loss nor gain of net heat, HOWEVER the work used to do this creates additional heat. If you consider this from a total energy standpoint, all energy within the room is fixed, except there's energy being added through the power input, so there's an increase in energy with time. I'm shocked at some of the other answers here, I hope those saying the temperature remains the same do not have mechanical engineering degrees. Menos

Mostrar Más respuestas

### An optimal algorithm to check whether a hand of cards was a full house (in Poker) or not.

9 respuestas

Check first card, store number of card, set first counter to one Check number of next cards - If different card, store number of card, set second counter to one, break - If same card, increment first counter, check if greater than three: - If less or equal to three, continue - If greater than three, return false Continue checking cards - If matching either stored card, increment respective counter, check if &gt;3 - If less or equal to three, continue - If greater than three, return false - If not matching either card, return false Return true Menos

1. Draw first card. card1 = firstCard and count1 = 1 2. Draw next card x and repeat upto step 12 for all cards 3. If (card2 != null &amp;&amp; (x!=card1 &amp;&amp; x != card2) 4. return false 5. if(x == card1) 7. count1++; 8. if(card2 == x) 9. count2++; 10. if (card2 == null) 11. card2 = x and count2 = 1 12. go to step 2 13. if(abs(count1-count2) == 1) 14. return true 15. else return false public static boolean isFullHouse(String[] s){ int count1 = 1, count2 = 0; String card1 = s, card2 = null, nextCard; for(int i = 1; i &lt; 5; i++){ nextCard = s[i]; if(card2 != null &amp;&amp; (!nextCard.equals(card1) &amp;&amp; !nextCard.equals(card2))) return false; if(nextCard.equals(card1)) count1++; else if(nextCard.equals(card2)) count2++; else if(card2 == null){ card2 = nextCard; count2 = 1; } } if(Math.abs(count2-count1) == 1) return true; else return false; } Menos

Most optimal and easy in my opinion: 1. Cards are represented as int : 2, 3, .., 10, 11='J', 12='Q',13= 'K',14= 'A' 2. Hand is build of n cards vector hand int bits; for(int i=1; i&lt;5; i++){ if(bits&amp;(1&lt; Menos

Mostrar Más respuestas
Viendo 1 - 10 de 7794 Preguntas de entrevistas