2110

Fragen aus Vorstellungsgesprächen für „ Mobile Engineer“, von Bewerbern geteilt

Top-Fragen in Vorstellungsgesprächen

Sortieren: Relevanz|Beliebtheit|Datum
Mobile Software Engineer wurde gefragt...26. Mai 2013

Although I have all the questions from all the interview stages documented in a word file, I am not sure if I am allowed to reveal them here. But to give you a hint, I will paste only a few questions here: Interview 1: how does traceroute work? difference between big endian and little endian (with example)? BSD vs GPL vs LGPL vs FSF vs GNU? 255 & 42 = ? solve in 15 sec 11 &lt;&lt; 2 = ? solve in 15 sec what is TTL in a packet? give examples of functional programming languages what other language runs on JVM? Interview 2: write code for fibonacci series. later, improve it. On-site Interview: (can't disclose)

4 Antworten

Very, very helpful !!!!Can you send it to me ? lastripper@gmail.com

I have applied for the mobile software engineer. do you think they can ask the same question for this post too? Weniger

Thanks for the review, it was really helpful. Can you send me the word document at johnycamanney@gmail.com Thanks! Weniger

Anzeigen Mehr Antworten

Implement a Sudoko puzzle validator - given a 9x9 matrix of numbers (1-9) and "." for empty spaces, return true for a valid puzzle matrix and false if it would not be a valid sudoku puzzle.

3 Antworten

Each iteration? You need just an iteration. Complexity o(n).

my solution was still O(n) - 3n to be exact. i "iterate" over the entire matrix 3 times - once to check for duplicates in the rows, once to check for duplicates in the columns, and once to check for duplicates within sub matrices. During each of those iterations I visit each element of the matrix exactly once and just check whether it's already in a dictionary of seen numbers which would be a constant time operation, so this is in total would be O(n). I can't think of how to check all those in just one iteration , if that's what you were saying you could do. (at least without using O(n) extra space.. mine only uses constant extra space) i would appreciate if you could elaborate Weniger

I basically just checked for duplicate numbers in each row, column, and then each 3x3 inner matrix. each iteration, i reset a dictionary of "seen" numbers. "." characters wouldn't matter, if i saw a number 1-9 i would check if it was already in the dictionary, if it was return false. return true at the very end if never encountered repeat numbers in rows, columns, or inner squares. when I explained this approach to the interviewer and he seemed satisfied with it although it was not easy to tell what the hell he was thinking or saying. i was working in a shared text file (i think it was codepen?), and even though the interviewer could have typed too, he didn't (even when i had to ask him repeatedly to spell a word i couldn't make out).. Weniger

Algorithms question was probably the trickiest thing. Given an array of integers of length N from 1 to N-1, how would you detect a single duplicate in the array?

3 Antworten

a xor a = 0 0 xor a = a so if we xor all elements 1 x 1 x 2 with all possible elements 1x2x3 = 0x3 = 3 still extra memory used but at least no overflow possibility. was it allowed to change the original input ? Weniger

1) Subtract each number from summation formula = N * (N+1) / 2 2) Hash table , zero out all entries when insert number -&gt; 1 after all insert look for 0 entry 3) XOR all elems -&gt; X XOR all # 1 to N -&gt; Y XOR of X and Y -&gt; missing # 15 ^ 12 ^ 15 = 12 Weniger

The first solution basically was to add up all the numbers in the array and the for N = 3 and in an array of 1 1 2, which totals to 4, total - N = 1. The duplicate is 1 He then turned up the difficulty to no additional memory space and to do it in big-O N time. Weniger

What's the angle between the hands of a clock if the time is 3:15.

3 Antworten

Oooooh, this was a sneaky trick question and I'm sorry I fell for it. Under the pressure of an interview, you might accidentally think the angle between the small and the large hands of a clock will pointing at the number "3" and therefore the angle would be zero. If you can keep a clear head, you're likely to realize really quickly that the small (hour) hand is going to be *beyond* the 3 by some relatively small angle. To be more precise, it'll be 1/4th of the distance between the hour numbers "3" and "4". Weniger

With 360 degrees in a circle and 12 hours throughout each cycle the distance between each number is 30 degrees. If the minute hand is pointing at the 3 and is fifteen minutes, fifteen minutes is 1/4 of the total amount of minutes on the clock, this puts the hour hand 30/4 degrees passed the 3 at 7.25 degrees. They'll enjoy you thinking analytically. Weniger

The answer should be a right angle.

Implement Integer.parseInt from scratch

3 Antworten

to study for this interview I suggest rewriting all of the basic Java methods ;)

can't u just parse char by char and use a bunch of shift operators and since ur just using charAt(i) to pick up a character u can use the same i and just raise it to the power of 10 and just or it with some bytes Weniger

public static int parseInt(String stringToConvert) { int i =0,num=0; int isNeg = 1; int length = stringToConvert.length(); if(stringToConvert.charAt(0) =='-') { isNeg=-1; i=1; } while(i Weniger

Numbers between 1 and n. There is a missing number and one number is repeated twice. Know Big O notation.

3 Antworten

Add up all the numbers in a single loop, find matching number, subtract it from sum to find missing number. Weniger

Hi your approach for both of the questions is perfect. Where did it go wrong? Why did they reject any ideas?? Weniger

Use the input array itself as a buffer to record appearances

You have a set of stairs. You can only move one or two steps at a time. Calculate how many possible combinations of moves can be made to traverse the exact number of steps, for any given total number of steps.

3 Antworten

^ yes it can, but that is a memorized solution that you likely wouldn't implement if you hadn't seen it before. i'm sure they don't use recursion on clients and i'm not exactly sure what this problem says about the interviewer other than "he doesn't leet". Weniger

It's actually a pretty simple dynamic programming problem you can solve using constant space, do it iteratively rather than recursively. Check it out of LeetCode. Weniger

This can be calculated with a simple recursive Fibonacci

Hardest Q was: Here's a binary tree: find the longest path within it. So, find a path between any two leaf nodes, where the path is the longest.

3 Antworten

class Solution{ int ans[] = new int; //O(n) public int efficientDia(TreeNode root) { if(root == null) return 0; int left = efficientDia(root.left); int right = efficientDia(root.right); ans = Math.max(ans, 1 + left+ right); return 1+ Math.max(left, right); } //O(n^2) public int getDiameter(TreeNode root) { if(root == null) return 0; int leftHeight = getHeight(root.left); int rightHeight = getHeight(root.right); if(ans &lt; 1 + leftHeight + rightHeight) { ans = 1 + leftHeight + rightHeight; } return Math.max(getDiameter(root.left), getDiameter(root.right)); } Weniger

int ans[] = new int; //O(n) public int efficientDia(TreeNode root) { if(root == null) return 0; int left = efficientDia(root.left); int right = efficientDia(root.right); ans = Math.max(ans, 1 + left+ right); return 1+ Math.max(left, right); } //O(n^2) public int getDiameter(TreeNode root) { if(root == null) return 0; int leftHeight = getHeight(root.left); int rightHeight = getHeight(root.right); if(ans &lt; 1 + leftHeight + rightHeight) { ans = 1 + leftHeight + rightHeight; } return Math.max(getDiameter(root.left), getDiameter(root.right)); } private int getHeight(TreeNode root) { // TODO Auto-generated method stub if(root == null) return 0; return Math.max(getHeight(root.left), getHeight(root.right))+1; } Weniger

Indians at all companies always ask tree questions, it makes them giggle inside. I know, because I'm half indian and have interviewed people... tee hee hee Weniger

Write a program/function to print out numbers from 1 to 100. If a number is multiple of 3, print "Foo" instead. If a number is multiple of 5, print "Bizz". If a number is multiple of both 3 and 5, print "FooBizz".

2 Antworten

public void printNumbers () { for (int i = 1; i &lt;= 100; ++i) { if (i % 3 == 0 &amp;&amp; i % 5 == 0) { System.out.println("FooBizz"); } else if (i % 3 == 0) { System.out.println("Foo"); } else if (i % 5 == 0) { System.out.println("Bizz"); } else { System.out.println(i); } } } Weniger

public void printNumbers () { for (int i = 1; i &lt;= 100; ++i) { if (i % 15==0) { System.out.println("FooBizz"); } else if (i % 3 == 0) { System.out.println("Foo"); } else if (i % 5 == 0) { System.out.println("Bizz"); } else { System.out.println(i); } } } Weniger

Write a command line program that acts as a simple calculator: it takes a single argument as an expression and prints out the integer result of evaluating it.

2 Antworten

import Foundation enum MathExpressionType: String { case Add = "add" case Multiply = "multiply" } extension String { func indexOf(_ input: String, options: String.CompareOptions = .literal) -&gt; String.Index? { return self.range(of: input, options: options)?.lowerBound } func lastIndexOf(_ input: String) -&gt; String.Index? { return indexOf(input, options: .backwards) } func nextIndexOf(_ input: String, from startPos: String.Index? = nil, options: String.CompareOptions = .literal) -&gt; String.Index? { let startPos = startPos ?? startIndex return self.range(of: input, options: options, range: startPos .. Int? { let expressionComponents = expression.split(separator: " ") let mathExpressionType: MathExpressionType = expressionComponents == MathExpressionType.Add.rawValue ? .Add : .Multiply guard let firstNumber = Int(expressionComponents), let secondNumber = Int(expressionComponents) else { return nil } switch mathExpressionType { case .Add: return firstNumber + secondNumber case .Multiply: return firstNumber * secondNumber } } func calculate(expression: String) -&gt; Int { if let number = Int(expression) { return number } var expr = expression var exprTotalCount = Int.max while exprTotalCount &gt; 0 { let leftIndex = expr.lastIndexOf("(") var rightIndex = expr.indexOf(")") if rightIndex! &lt; leftIndex! { rightIndex = expr.nextIndexOf(")", from: leftIndex) } let subString = String(expr[expr.index(after: leftIndex!).. Weniger

return self.range(of: input, options: options, range: startPos .. Int? { Is little unclear. First the .. between startPos and Int? The open bracket after Int? has not closing match. Does the code after return execute? Can you post a little more clear solution. Thank you Weniger

1 - 10 von 2.110 angezeigt Fragen im Vorstellungsgespräch