Find jobs for de

De Interview Questions


De interview questions shared by candidates

Top Interview Questions

Sort: Relevance|Popular|Date
Software Engineer was asked...June 19, 2012

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 Answers

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

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}. Less

reading these answers is such a confidence builder.

Show More Responses
Bloomberg L.P.

An array of 99 elements contains integers from 1 to 100 with one missing element. Find the missing element.

20 Answers

1. calculate the sum of elements in array say SUM 2. sum of numbers 1 to 100 is(n* (n+1))/2 = 5050 when n==100 3. missing element is (5050-SUM) Less

Sum them and then subtract them from 5050. In general, if an array of size n - 1 elements has unique elements from 1 to n, then the missing element can be found by subtracting the sum of the elements in the array from sum(1 ... n) = n * (n + 1) / 2. Alternately, one could use a boolean array of length n with all values set to false and then for each value, set array[val - 1] to true. To find the missing value, scan through the array and find the index which is set to false. Return index + 1. This requires O(n) memory and two passes over an O(n) array (instead of constant memory and one pass), but has the advantage of actually allowing you to verify whether or not the input was well formed. Less

Read the question. Here are the steps to solve it: 1) find the sum of integers 1 to 100 2) subtract the sum of the 99 members of your set 3) the result is your missing element! Very satisfying! Less

Show More Responses

Find the second largest element in a Binary Search Tree

15 Answers

The above answer is also wrong; Node findSceondLargest(Node root) { // If tree is null or is single node only, return null (no second largest) if (root==null || (root.left==null && root.right==null)) return null; Node parent = null, child = root; // find the right most child while (child.right!=null) { parent = child; child = child.right; } // if the right most child has no left child, then it's parent is second largest if (child.left==null) return parent; // otherwise, return left child's rightmost child as second largest child = child.left; while (child.right!=null) child = child.right; return child; } Less

find the right most element. If this is a right node with no children, return its parent. if this is not, return the largest element of its left child. Less

One addition is the situation where the tree has no right branch (root is largest). In this special case, it does not have a parent. So it's better to keep track of parent and current pointers, if different, the original method by the candidate works well, if the same (which means the root situation), find the largest of its left branch. Less

Show More Responses

The manager of component 'A' says his functionality is more important than that of component 'B.' The manager of component 'B' says his is more important than that of component 'A.' You can only implement one A or B, but not both - which do you choose to implement.

14 Answers

The key question to ask is definition of "IMPORTANT". Is it important to the managers (ego equation), important to the end consumer or important for Amazon. The first one needs to be thrown out immediately and the others must be quantified based on achievability, impact on end user and ROI. Less

I would say whichever is more valuable to customer & gives competitive advantage to Amazon. Less

In addition to the above suggestions, I would look at cost and time to market and then score both options. Then define value metrics. The cheapest and most valuable either as a technology sustainer or for customer wins. Given that it's Amazon, customer value will hold up the highest as one of their corporate culture virtues. Less

Show More Responses

Write some pseudo code to raise a number to a power.

11 Answers

int raise(num, power){ if(power==0) return 1; if(power==1) return num; return(raise(num, power-1)*num); } Less

small mistake function power(x, n) { if n == 1 return x; // Even numbers else if (n%2 == 0) return square( power (x, n/2)); // Odd numbers else return power(x, n-1) * x; } Less

double Power(int x, int y) { double ret = 1; double power = x; while (y > 0) { if (y & 1) { ret *= power; } power *= power; y >>= 1; } return ret; } Less

Show More Responses

How do you make people choose a product they don't want.

8 Answers

Highlight the must-have features.

First of all I will build trust and communicate with his human basic needs I will explore his feelings and wishes; what he like and what he doesn't Then I concentrate on the benifits and advantages he may got with the new products Less

Really? You don't. Understand their pain, their needs, their likely use cases, then sell them what they do need. In the long run, matching the solution to their needs is aligned with their wants and will yield a happier, more loyal, and better relationship with the brand. Less

Show More Responses

How would you deal with screaming customers or stressful environments?

7 Answers

Let them vent. You have to understand the customer from their point of view. Sometimes you have to put yourself in their place. Make sure you reassure the customer the issue will be resolved. I may take sometime but their is always a resolution for a problem. Must have confidence. Because if the customer doesn’t feel you’re confident then they’ll doubt everything you’re saying. Do literally everything you can and be nice for quality purposes. Less

Real calm hear the customer out. Empathize with and assure you are here to help them Less

Calming voice, listen closely and stay optimistic without being defensive.

Show More Responses

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.

7 Answers

O(size of array) time & space: First, realize that saying the element should be the product of all other numbers is like saying it is the product of all the numbers to the left, times the product of all the numbers to the right. This is the main idea. Call the original array A, with n elements. Index it with C notation, i.e. from A[0] to A[n - 1]. Create a new array B, also with n elements (can be uninitialized). Then, do this: Accumulator = 1 For i = 0 to n - 2: Accumulator *= A[i] B[i + 1] = Accumulator Accumulator = 1 For i = n - 1 down to 1: Accumulator *= A[i] B[i - 1] *= Accumulator Replace A with B It traverses A twice and executes 2n multiplicates, hence O(n) time It creates an array B with the same size as A, hence O(n) temporary space Less

Create two more arrays. One array contains the products of the elements going upward. That is, B[0] = A[0], B[1] = A[0] * A[1], B[2] = B[1] * A[2], and so on. The other array contains the products of the elements going down. That is, C[n] = A[n], C[n-1] = A[n] * A[n-1], and so on. Now A[i] is simply B[i-1] * C[i+1]. Less

Here are my 2 cents to do this in memory without creating temporary arrays. The simple solution , if division was allowed, was multiple all the elements of the array i.e. tolal = A[0]*A[1]]*....*A[n-1] now take a loop of array and update element i with A[i] = toal/A[i] Since division is not allowed we have to simulate it. If we say X*Y = Z, it means if X is added Y times it is equal to Z e.g. 2*3 = 6, which also means 2+2+2 = 6. This can be used in reverse to find how mach times X is added to get Z. Here is my C solution, which take pointer to array head A[0] and size of array as input void ArrayMult(int *A, int size) { int total= 1; for(int i=0; i< size; ++i) total *= A[i]; for(int i=0; i< size; ++i) { int temp = total; int cnt = 0; while(temp) { temp -=A[i]; cnt++; } A[i] = cnt; } } Speed in O(n) and space is O(1) Less

Show More Responses
Capital One

Case interview: basic business problem (if product X costs Capital One $4.00 per unit, with a $800 sunk cost, and we charge X amount of dollars along with a $10 annual fee, how many do we need to sell to break even, etc). Followed by a longer discussion of more complex problems that the situation might entail.

7 Answers

Actually, to correct the above response, if the selling price for 1 product is $794 (to cover the cost price of the product itself ($4) ), only 1 quantity needs to be sold. ($794 + $10) = ($800 + $4). Less

How is it possible to answer this without knowing the selling price per product? # of quantities to sell in order to breakeven depends on how much the selling price per product is? Since the selling price says X, you can sell it for $790 and breakeven by just selling 1 product ($790 per product + $10 annual fee (assuming it's per product)). But I may be misunderstanding the information provided. Any feedback? Less

Erin - it probably shouldn't be. The Revenue side should be (unit price + 10) * number of units sold. Dapo has assumed that unit price and number of units sold is the same since the letter X is used to describe both variables. That might be correct, but it would be an odd quirk of the question - I'd bet that you can ask what the unit price is. Less

Show More Responses

How would you respond to a customer that is complaining they have a hole in a product they just purchased?

7 Answers

Respond to the customer by apologizing for their inconvenience and let them know you will do everything in your power to rectify the situation. Never promise money or product as a solution until it is fact. Less

Apologize for the damaged item and explain what you can do to replace the. Item

Respond to the customer by apologizing for their inconvenience and let them know you will do everything in your power to rectify the situation Less

Show More Responses
Viewing 1 - 10 of 843,312 Interview Questions