Fragen im Bewerbungsgespräch: Software engineer | Glassdoor.ch

# Fragen im Vorstellungsgespräch: Software engineer

424

Fragen aus Vorstellungsgesprächen für software engineer, von Bewerbern geteilt

## Top Vorstellungsgespräch-Fragen

Sortieren: RelevanzBeliebtheit Datum

### Ein Bewerber für eine Stelle als Software Engineer bei Google wurde gefragt...

28. Feb. 2016
 The question was to find all taxi numbers from 0 - 10^6. Taxi number is a number which can be written as the sum of two squared number, and can be written as two different representations: Taxi number = a^2 + b^2 = c^2 + d^23 Antwortenrange of a will be 10^3, and range of b is at most also 10^3. Then we have a for loop for a and for loop for b, then we also define a hashMap to count how many forms a number has, at the end, if it has 2 forms, we print it as taxi numberA={0}; for i ->1-1000, for j->i to 1000, A[i*i+j*j]++ for i 1-1000000 if A[i]>1 print idef taxi(num): dict = {} for i in range(1, sqrt(num)): for j in range(i+1, sqrt(num)): if i*j in dict.keys(): dict[i*j] += 1 else: dict[i*j] = 1 for k in dict.keys(): if dict[k] > 1: print k

### Ein Bewerber für eine Stelle als Softwareentwickler bei Google wurde gefragt...

31. Dez. 2010
 Erstellen Sie einen Algorithmus, der n Karten auf n+1 Positionen (eine Position ist leer) verteilt, erreichen Sie eine abschließende Sortierung (ausgehend von einer initialen), zeigen Sie alle Schritte dazwischen. Ein Positionswechsel ist nur dann valide, wenn die Karte auf die leere Position gelegt wird (und die ursprüngliche Position der Karte dann leer ist).3 AntwortenI do not understand the problem the way it is formulated. Sentences do not seem to make any sense.OK, I think I know the right question: Each of N distinct cards occupies one of (N+1) slots, so one slot is empty. For each card the destination slot is known. How to place each card into its destination slot if the only legal move is to remove a card from its current slot and insert it into an empty slot? Let's number slots 0 through n and represent current setup as an integer array V of size (n+1). Each value V[i] is the destination slot number for the card that currently occupies slot #i. The destination slot number for the empty slot is some number K, so when we encounter V[i] == K, it designates an empty slot. Then this become a sorting problem with the twist: sorting can only be performed by swapping a pair of elements V[i] with V[j] where either V[i] or V[j] equals K. Suppose we know the initial empty slot position K0, so that V[K0] == K, or we can find it by linear search. The following code: int n_placed = 0; for (int slot = 0; slot <= n; ++slot) { int destination_slot = V[slot]; if (destinationn_slot != slot) { // card not where it should be swap(V, destination_slot, K0]; // move card currently in destination slot to empty slot swap(V, slot, destination_slot); // move card from current slot to empty destination slot K0 = slot; // update empty slot's position to current slot ++n_placed; } } is guaranteed to increase the number of cards in their final slots at least by 1. It can be repeated till n_placed is no longer incremented. It may be optimized, I guess, but this is the idea.recursively: if (configuration equals the final configuration){ END } if(there is a card x whose final destination is the emptyslot){ move x to the empty slot recursively apply the procedure to the remaining configuration } else{ find a card x that is not in its intended slot put x in the empty slot recursively apply the procedure to the remaining configuration } End Note that this procedure always terminates since the recursive call after the else can never be executed twice in a row as in the final configuration there is only one empty slot...

### Ein Bewerber für eine Stelle als Softwareentwickler bei Google wurde gefragt...

13. Sept. 2011
 Worin liegt die Komplexität, etwas in eine Hashtabelle einzufügen?3 AntwortenO(1) averageHashing with Chaining : alowing more than one value mapped to the same cell. w.c. = amortized = O(1) Hashing with open addressing : no collision, w.c - O(n) (if all cells are taken but one, it can take a while to rehash and find it) amortized = O(1/(1-(n/m)) where n=number of keys already there, m=number of cellsHashing with chaining would actually take O(1+n/m) if the keys are unique. That is O(1) if n/m is constant.

### Ein Bewerber für eine Stelle als Softwareentwickler bei Google wurde gefragt...

14. Sept. 2010
 (Ohne Ihnen die spezifische Frage zu verraten,) schäzen Sie, wie viele Bits ich für den Hash-Key in ihrer Lösung benutzen sollte? Begründen Sie!2 AntwortenThe collision probability plot shows a phase transition. Beyond that point (pretty suddenly) you will get collisions with very high probability. For more details check out "birthday attack"For any key of size n, you need log(n) bits. For ex, ABC can have 2^3 different variations - ABC, ACB, BAC, BCA,.... and so 3 bits are enough to represent that key.

### Ein Bewerber für eine Stelle als Senior Software Engineer bei Google wurde gefragt...

28. Sept. 2017
 what kind on an animal would i choose to be?2 Antworteni picked a liger, which is a mix between a lion and tiger.donkey if hired

### Ein Bewerber für eine Stelle als Software Engineer bei Google wurde gefragt...

11. Dez. 2015
 You have a list of matches, where each match is a pair of ints meaning (ID of Player One, ID of Player Two) where in that match player one is better than player two. Make a ranking of all the players in order.2 AntwortenThink of each match as a node in an (acyclic) graph and then just topological sort it. Won't work if a winning b and b winning c doesn't imply that a wins c.What if you just sort by number of wins? And then in case of equal points compare personal matches

### Ein Bewerber für eine Stelle als Softwareentwickler bei Google wurde gefragt...

13. Dez. 2012
 Der Interviewer kam mit einem Kartendeck. Es ist ein einfaches Spiel, die Karten werden aufeinander gelegt, in jedem Schritt nimmt man die oberste Karte weg, nimmt dann eine weitere von oben und legt sie nach unten. Das wird wiederholt bis alle Karten weg sind. In wie vielen dieser Wiederholungen wirst du die Anfangssequenz als verworfene Sequenz finden?2 AntwortenTry!Well, it seems we get the same sequence after 1392, which is 52*26

### Ein Bewerber für eine Stelle als Softwareentwickler bei Google wurde gefragt...

11. Aug. 2011
 Man bekommt eine Zeichenkette und soll das Zeichen mit der größten Häufigkeit finden.2 AntwortenConsider hashmap of counters approach, or array of counters depending on the range of valid characters.Implemented with array of counter, where arr[a] will have number of letter a aperances. the complexity is o(n+k) where k number of letters is the alpabet, n is the length of the word. public class FrequentLettre{ public static char findFrequent(String str){ str = str.toLowerCase(); char[] chars = str.toCharArray(); int size = 'z'-'a'+1; int[] frequent = new int[size]; for (char c : chars){ ++frequent[c-'a']; } int max = frequent['a'-'a']; int maxInd = 0; for (int i=1; i max){ max = frequent[i]; maxInd = i; } } return (char) ('a'+maxInd); } public static void main (String[] args){ System.out.println(findFrequent("apple")); } }

### Ein Bewerber für eine Stelle als Software Engineer bei SOPHiA GENETICS wurde gefragt...

20. Feb. 2020
 Are you willing to be underpaid for the right mission? What's your family situation? This job will require most of your focus and time. Are you pregnant? This could be a problem.2 AntwortenI was shocked as a woman to be asked such inappropriate questions.Did you know that you can actually file a complain and sue the company if they asked this question? I know that most people in this company think they are above the law (incl the CEO), but things are starting to change and lawsuits are piling up.

22. März 2018