364 mil

Preguntas de entrevista para Software Engineer compartidas por los candidatos

Principales preguntas de entrevista

Ordenar: Relevancia|Popular|Fecha
A un Software Engineer le preguntaron...29 de octubre de 2015

how do you get an Elephant in the fridge?

27 respuestas

take the Giraffe out first?

Open the fridge door, take the elephant then put it in the fridge, close the fridge door. Done Menos

I don't know! But do you know how to tell if there's an elephant in your fridge? There's footprints in the the butter. How can you tell when there's TWO elephants in your fridge? You hear giggling inside. How can you tell when there's THREE elephants in your fridge? You can't close the door. You're welcome. Menos

Mostrar Más respuestas

Given an input string S write a function which returns true if it satisfies S = nT. Basically you have to find if a given string can be represented from a substring by iterating it “n” times. n &gt;= 2 An example would suffice – Function should return true if 1) S = “abab” 2) S = “abcdabcd” 3) S = “abcabcabc” 4) S = “zzxzzxzzx” Function should return false if 1) S = “abac” 2) S = “abcdabbd” 3) S = “abcabcefg” 4) S = “zzxzzyzzx” It would be easy to understand if you can give an algo instead of saying use kmp or suffix tree or… I came up with O(n*n) solution. Wondered how to do in O(n)

27 respuestas

public static boolean getRepeatingSubStringLinear(String word) { int p = 0; for (int i = 1; i &lt; word.length(); i++) { if (word.charAt(p) == word.charAt(i)) { p++; } else { p = 0; } } if (p != 0 &amp;&amp; word.length()%(word.length() - p) == 0) { return true; } else { return false; } } Menos

nimo's solution is almost correct. However wrong for case like "axaaxaaxa". correction: 2) find D = highest common denominator of all non-zero values in array. if not exist (other than 1), return false. 3) divide each array entry by D 4) calculate sum of all array cells - this is the substring length. 5) check repeat of that substring in the whole string Menos

dux2`s solution is correct. I've changed step 2, instead of calculating GCD I've used minimum of occurrences of character from input string. Here is my solution: http://pastebin.com/sJYbuQju Complexity of my algorithms is O(N). Menos

Mostrar Más respuestas

In front of you are three light switches. Only one does anything, and it turns on the light downstairs. From here you can't see the light, and it makes no sound. You must determine which switch operates the light, BUT you can only go check it once. How do you figure out which switch is for the light?

26 respuestas

Flip any switch you want. Wait for about 5-10 minutes to let the bulb heat up. Flip that same switch off, and another one on. Go check the light. If it's off and hot, it was the first switch, if it's on it was the second and if it's cold and off, it was the last one. Menos

Flip the switch on one end, wait a "long" time (e.g., 15 minutes); then flip the middle switch; them immediately go check the light for on/off status and temperature. If off: the switch you didn't change controls the light; If on and surrounding fixtures slightly warm, the middle switch controls the light; If on and surrounding fixtures fully warm of hot, the first switch controls the light. Menos

Tell the HR interviewer to go stick his/her finger in the light socket and scream when you flip the correct switch. Menos

Mostrar Más respuestas

What happens when you have much subscribers to an event and an exception would raise in one of them?

25 respuestas

The answer is fired Clark Tiu from Hong Kong

The only exception is fired the useless Clark Tiu from Hong Kong office

A good software developer not only has the technical ability to take upon a task and is able to handle projects at same time. A bad developer is named Clark Tiu, who sit on his soft chair all day reading his news and chatting with his personal friends. Clark is a butt kisser and is the ONLY reason he's still surviving at Dealogic. He has 0 tech abilities and 120% butt kissing. I wabt to see how Clark I Pretend to Work Tiu survives with everyone leaving. Menos

Mostrar Más respuestas

How many bottles of shampoo are produced in the world a year?

25 respuestas

Let's start with the US market: 300X10^6 people. About 60% use shampoo (others are bald or use soap). They go through about one bottle every two months, so that is about 1.8X10^9. Human population is about 6.6 X 10^9. As far as the undeveloped nations, most people don't use shampoo. The developed world is about four times the size of the US population or approximately 1.2 X 10^9. People in the US wash their hair more than in Europe, but I will neglect this. My estimate is about 5X10^9 bottles. Menos

Lets look again at the question- it is not 'how many bottles of shampoo are USED" the question clearly states "how many bottles of shampoo are PRODUCED in the world in a year". It interests me to note that this is a production question for a software engineer position which clearly leads me to determine that the answer is not meant to be a number but a program or mathmatical equation of some sort. There is not enough information listed to solve to any given number with so many variables, and it is not safe to assume that 50% of the population uses shampoo or how many people are bald. The idea is to take the information given and develop a method to calculate the numerical value if the actual values are supplied. Menos

Enough to wash everyone's hair.

Mostrar Más respuestas

implement the dynamic polymorphism

23 respuestas

Could you please answer me .what are the 2 coding questions you were asked in the round 2 so that we have an idea of what kind of questions they were expecting ? Hope a reply from you.Thank You Menos

Is it the same type of questions asked as he mentioned? or different set of questions. Is it through epam test portal? Menos

Already they have sent the mail's for second round for some people. Tommorow they have second round with following others rounds Menos

Mostrar Más respuestas

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

20 respuestas

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) Menos

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. Menos

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! Menos

Mostrar Más respuestas

The final round of interview was challenging in terms of how you pick scenarios from your career.

21 respuestas

Out of the 4 scenarios - I realized its better to show both sides of the coin and treaded one positive experience followed by negative experience. It was fulfilling to mention that a mistake was made due to XYZ reasons and was corrected in future assignments. Menos

Hi ABC can u share what kind of techincal question they have asked, r they asked to write program or only oral with usecases? as i am having my interview on next week for java developer. Menos

For me, they obtained declaration to carry out BG check 10 days prior to joining and I was not contacted further in this regard. For some colleagues, third party requested for additional docs. Am not sure on the status of my application on shell portal. Menos

Mostrar Más respuestas

Given an array of ints = [6, 4, 0, 5, 0, 0, 0, 1, 0] move all non zero numbers to the left and zeros to the right. How can you now improve your answer to O(n)?

21 respuestas

Just keep pointers to the first and last elements of a new array. private static int[] moveZerosToLeft(int[] arr) { int first = 0; int last = arr.length - 1; int[] newArr = new int[arr.length]; for (int i = 0; i &lt; arr.length; i++) { if (arr[i] == 0) { newArr[last--] = arr[i]; } else { newArr[first++] = arr[i]; } } return newArr; } Menos

Since the order doesn't matter. Keep a separate pointer for your array. iterate through the array, for every 0 you find, swap it with the value at array[k], then increment k. This would be O(n) Otherwise, just sort it and return that. Which is O(nlogn) Menos

O(n) is the best conceivable time for this type of sort Here's one way to solve it: private static void moveZerosToRight(int[] a) { int rightIndex = a.length - 1; int leftIndex = 0; while (leftIndex &lt; rightIndex) { if (a[rightIndex] == 0) rightIndex--; else { if (a[leftIndex] == 0) { swap(a, leftIndex, rightIndex); rightIndex--; } leftIndex++; } } } private static void swap(int[] a, int i, int j) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } Menos

Mostrar Más respuestas

Write an algorithm to determine whether a given number is of the form (2^n)+1, where n is an integer.

20 respuestas

return (n == 1) || ((n-1)&amp;(n-2) == 0);

boolean isapower(int pow, int num); int main(){ int num = 2; int pow = 2; if(isapower(pow, num-1)) { printf("%d is power of %d + 1", num, pow); } else { printf("%d is not power of %d + 1", num, pow); } return 0; } boolean isapower(int pow, int num) { while((num &gt; pow) &amp;&amp; (num % pow == 0)) { num /= pow; }; return num == pow; } Menos

Sorry. That answer is for checking odd or even. Not power of 2 + 1.

Mostrar Más respuestas
Viendo 21 - 30 de 364.341 Preguntas de entrevista