# 365 k

Questions d'entretien pour Software Engineer partagées par les candidats

## Principales questions d'entretien

Trier: Pertinence|Populaires|Date
On a demandé à Software Developer...2 mars 2011

### Cure world hunger.

37 réponses

condoms

Birth control plain and simple. Control birth rates by people using preventative measures and you reduce birth rates. Providing more food does not solve the problem because they just keep multiplying over and over. Thats why birth control is the only real solution. Moins

If someone in an interview looked me in the eye and said, "Cure world hunger," I'd say, "Great. I'd be happy to! Let me know what I have to work with, how large the team is and, by the way, what's the salary for this? I'm ready." Moins

Afficher Plus de réponses

### You have a 100 coins laying flat on a table, each with a head side and a tail side. 10 of them are heads up, 90 are tails up. You can't feel, see or in any other way find out which side is up. Split the coins into two piles such that there are the same number of heads in each pile.

36 réponses

Split into two piles, one with 90 coins and the other with 10. Flip over every coin in the pile with 10 coins. Moins

Pick 10 coins from the original 100 and put them in a separate pile. Then flip those 10 coins over. The two piles are now guaranteed to have the same number of heads. For a general solution of N heads and a total of M coins: 1.) Pick any N coins out of the original group and form a second pile. 2.) Flip the new pile of N coins over. Done. Example (N=2, M=6): Original group is HHTTTT (mixed randomly). Pick any two of these and flip them over. There are only three possible scenarios: 1: The two coins you picked are both tails. New groups are {HHTT} {TT} and when you flip the 2nd group you have {HHTT} and {HH}. 2.) The two coins you picked consist of one head and one tail. New groups are {HTTT} and {HT} and when you flip the 2nd group you have {HTTT} and {TH}. 3.) The two coins you picked are both heads. New groups are {TTTT} and {HH} and when you flip the 2nd group you have {TTTT} and {TT}. Moins

Afficher Plus de réponses

35 réponses

there will be three programming questions,first one was displaying the particular array element whose index will be given input,but we need to use exceptional handling. the second question was finding repeated letter in a given word along with its count, and the third one was extracting string within given xml tags,ex:<div>hai</div> your output should be hai. Moins

Round 2 contains two coding questions and 10 mcqs. Mcqs based on core subjects of computer science and those two coding questions will be of level 3 - level 4 in difficulty . implementing the interfaces using inheritance , or sorting some data with some constraints , collections , algorithms implementation like shortest path , merge sort techniques etc . Moins

Hello, can you tell what type of questions they asked in 2nd coding round?

Afficher Plus de réponses

### Given an array of numbers, replace each number with the product of all the numbers in the array except the number itself *without* using division.

34 réponses

It seems to me that for any number array[i], you're looking for PRODUCT(all array[j] where j i]) we can simply precompute these "running products" first from left-to-right, then right-to-left, storing the results in arrays. So, leftProduct[0] = array[0]; for j=1; j = 0; j-- rightProduct[j] = rightProduct[j+1]*array[j]; then to get our answer we just overwrite the original array with the desired product array[0] = rightProduct[1]; array[n-1] = leftProduct[n-2]; for j=1; j &lt; n-1; j++ array[j] = leftProduct[j-1] * rightProduct[j+1] and clearly this solution is O(n) since we just traversed the data 3 times and did a constant amount of work for each cell. Moins

betterStill, I think you have the answer the interviewer wanted.. But... if the array is google sized, don't we have to worry about overflows? Moins

narya trick is good but really useful as it might take more iterations depending on values... eg. 2,3,1000000000000000 so if you have 3 numbers and if you are trying for the first one it will go for 500000000000000 iterations, hence as the overall product value wrt to the value matters a lot... try something else.... Moins

Afficher Plus de réponses

### Given the numbers 1 to 1000, what is the minimum numbers guesses needed to find a specific number if you are given the hint "higher" or "lower" for each guess you make.

32 réponses

Nope, I don't think it's 63. It's a binary search as mentioned above. It should be about 10: Arbitrarily let's say the answer is 1000, so every time you guess, the response will be "no, it's higher". 1) 1 - 1000, guess 500. 2) 501 - 1000, guess 750. 3) 751 - 1000, guess 875. 4) 876 - 1000, guess 938. 5) 939 - 1000, guess 969. 6) 970 - 1000, guess 985. 7) 986 - 1000, guess 993. 8) 994 - 1000, guess 997. 9) 998 - 1000, guess 999. 10) guess 1000. Moins

When hiring for a programmer, you do not want someone who "thinks on (their) feet." And the questions are not "on the fly." If someone asks you questions on the fly at an interview, spend your lunchtime applying elsewhere as they have not thought out how to hire the best staff. A good hiring process includes hard questions that offer insight into the applicant and their abilities. Anytime I (or friends) applied for programming jobs, questions like this during the interview were standard. If you could not give a full response (showing the methodology), you did not get the job. While a nice trait to have in a team member, programmers need to be able to code. Bracketing (see Mike's answer, above) is the fastest way. It's boring but it works. Moins

It IS the binary search; the *minimum* number of guesses would be 1 (if you guessed the correct number right off the bat) and the number of guesses in the average/worst cases would be log N, which is log 1000, ie approximately 10. Moins

Afficher Plus de réponses

### write a program in c/c++/java to print the pattern 1 2*2 3*3*3 4*4*4*4 4*4*4*4 3*3*3 2*2 1

32 réponses

there is a problem that only half of my code is getting displayed

import java.io.BufferedReader; import java.io.InputStreamReader; public class Solution { public static void main(String [] args) throws Exception{ int i , j , k=1 , n; BufferedReader bufferedReader= new BufferedReader(new InputStreamReader(System.in)); n=Integer.parseInt(bufferedReader.readLine()); for (i=1;i&lt;=n*2;i++){ if (i&lt;=n) { for (j = 1; j &lt;= i * 2 - 1; j++) { if (j % 2 == 0) { System.out.print("*"); } else { System.out.print("" + i); } } } else { for (j = 1; j &lt;= 2*(i-k)-1; j++) { if (j % 2 == 0) { System.out.print("*"); } else { System.out.print("" + (i-k)); } } k+=2; } System.out.println(""); } } } Moins

#include void print_pattern(int); int main() { int n; scanf("%d",&amp;n); print_pattern(n); return 0; } void print_pattern(int n) { for(int i=1;i0;i--) { for(int j=1;j&lt;=i;j++) { if(i==1) { printf("%d",i); } else { printf("%d",i); if(j!=i) { printf("*"); } } } printf("\n"); } } Moins

Afficher Plus de réponses

### Unexpected: Puzzle question. If you have 2 eggs, and you want to figure out what's the highest floor from which you can drop the egg without breaking it, how would you do it? What's the optimal solution?

30 réponses

This is common sense. Eggs will break even when dropped from a 1 ft. So, keep the eggs and make an omelette. Moins

Assuming the 1st floor does not count, I would start on the third floor. If it breaks, try the next egg on the 2nd floor. The answer would be I can drop it from the 2nd floor, or it will always break (remember the 1st does not count). Now assume the first egg did not break, we know the 3rd floor is safe. You still have one more egg to spare, try it on the 4th floor. The conclusion will be either you can drop an egg on the 3rd floor or 4th floor, based the result of the 2nd egg. Now if the 1st floor counts, minus the floor number by 1 on all the floor numbers above. Moins

int get_safefloor( int highest_safe_floor = 1 ) { floor = highest_safe_floor + 2; if( brokenegg( floor ) ) { if( brokenegg( floor - 1 ) ) return floor; else return floor - 1; } return get_safefloor( floor + 2 ); } Moins

Afficher Plus de réponses

### GIven 9 balls all of which weigh the same except for one, what is the minimum of weighings necessary to find the ball weighs more (or less).

29 réponses

I agree with Anonymous in that these questions don't tell much about character. However, I can't beleive nobody here is analytical enough to come up with the correct answer. First off, the question is not stated correctly. The scale should be a simple balance, and the objective is to find the "odd" ball AND determine if it is heavy or light. The answer is three. First separate into three groups of three, G1, G2, and G3. In the first two weighings you can determine which group has the "odd" ball AND if the odd ball is heavy or light. Weighing 1 - weigh G1 against G2: Two outcomes 1) G1 == G2 --&gt; Odd ball is in G3, in Weighnig 2, use either G1 or G2 against G3 to determine if Oddball is H or L 2) G1 != G2 -&gt; Odd ball is NOT in G3 but you now know if G1 is heavier or lighter than G2, in Weghing 2, use either G1 or G2 against G3, for instance use G2 and G3, if same, then G1 has oddball and you know if its H or L, if G2 != G3, then G2 has odd ball and you know if it is H or L Now that you know which G it is in And the disposition of the Oddball (Heavy or Light), weigh any two of the Group containing the oddball, and based on your knowledge of wether the oddball is H or L, you know which one it is and its disposition. Any offers?? Moins

You could do this with two weighings assuming its a two pan balance - (1) place three balls on each side - if they balance out then its the remaining three that has abnormal ball (2) out of that group, place one ball on each side - if balances it out, the abnormal ball is the remaining one. If the weighing in step (1) does not balance out, grab the group of three balls that is light or heavy and repeat step (2) described above. Moins

While the solution above is correct, more or less, you first should clarify the question and spell out any assumptions. The assumption here is that you know or are aware beforehand that only one ball is of different weight. Sometimes your ability to clarify and state assumptions is more valuable than getting the right answer. Sometimes you can arrive at the right answer with the wrong logic which helps you solve this problem, but may mess you up in the future. Moins

Afficher Plus de réponses

### Question was "Given a pattern and a string input - find if the string follows the same pattern and return 0 or 1. Examples: 1) Pattern : "abba", input: "redblueredblue" should return 1. 2) Pattern: "aaaa", input: "asdasdasdasd" should return 1. 3) Pattern: "aabb", input: "xyzabcxzyabc" should return 0.

29 réponses

Brute force: (takes about 2 seconds to think of) Match the first letter in the pattern with the first n letters of the string. (use a hash map to equate them) Take the remaining pattern and the remainder of string and recurse, except you must make sure to pass in the hash map as well. If the next character in the pattern is not in the hash map, then do the same. If it is, then check to see if the n length key exists in the string. I think this solution will have an O(n^m) time, where n is the length of the string and m is the number of distinct characters in the pattern. Moins

How is that a DFS problem?

this question seems to be unreasonably hard for a 1-hour exercise

Afficher Plus de réponses

### Mostly behavioral, and includes the coding sessions as well. They look at your approach and ask you the questions on what your approach is and why

27 réponses

I emailed the HR. She said there are lot of applications and it's taking time.

Can you please elaborate the questions you faced.

@ continue above what salary did they offer and any signup bonus and relocation things. Moins

Afficher Plus de réponses
11 - 20 sur 364 960 Questions d'entretien