Mobile developer Interview Questions | Glassdoor

# Mobile developer Interview Questions

439

mobile developer interview questions shared by candidates

## Top Interview Questions

Sort: RelevancePopular Date

May 11, 2016

### Mobile Software Engineer at Uber was asked...

Sep 15, 2015
 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.4 AnswersI 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)..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 elaborateShow More ResponsesO(n) == O(n)-3n It's still the same big-oh complexity.

### Mobile Software Engineer at Nest was asked...

Feb 5, 2016
 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 AnswersThe 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.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 ?1) Subtract each number from summation formula = N * (N+1) / 2 2) Hash table , zero out all entries when insert number -> 1 after all insert look for 0 entry 3) XOR all elems -> X XOR all # 1 to N -> Y XOR of X and Y -> missing # 15 ^ 12 ^ 15 = 12

### Mobile Software Engineer at ESPN was asked...

Jan 24, 2013
 What's the angle between the hands of a clock if the time is 3:15.3 AnswersOooooh, 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".The answer should be a right angle.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.

### Senior Mobile Software Engineer for AWS at Amazon was asked...

May 19, 2013
 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 AnswersIndians 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 heeclass 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 < 1 + leftHeight + rightHeight) { ans = 1 + leftHeight + rightHeight; } return Math.max(getDiameter(root.left), getDiameter(root.right)); }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 < 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; }

Mar 17, 2014
 2nd skype: - Lets say you have to build an activity (screen) which has a drop-down & once you select an item in the drop-down, it loads an image corresponding to that on the screen below. - How will handle cases where user is very rapidly changing his selection from the drop down2 Answers- Use aync task for the same - Use some kind of timeout mechanism.Rxjava with switchMap

### Mobile Software Engineer at IonGrid was asked...

Dec 5, 2012
 If one has a collection of N stock options vesting over P periods, describe algorithmically how one would come up with the data for a table listing how many options are awarded per period.2 AnswersThe twist to this question is that you have to keep track of fractional shares. If you have 200 shares voting over 6 periods, stock grants 1 & 2 will be 33 shares and grant # 3 will be 34 shares. My own answer wasn't quite right because I was thinking "oh, we can just accumulate .33 fractional shares over the first two periods and then issue one extra share on the 3rd), while what the questioner really wanted to see was a share represented as 1/3, 2/3 and then 3/3 (i.e. a true fraction and not a decimal number subject to rounding errors).public static List StockDisbursements(int numberOfStocks, int vestingPeriods) { List disbursements = new List(); int disbursement = numberOfStocks / vestingPeriods; int remainder = numberOfStocks % vestingPeriods; int sum = 0, tempVestingPeriods = vestingPeriods; while (sum 0) { disbursements.Add(disbursement); sum += disbursement; } else { disbursements.Add(disbursement + 1); sum += disbursement + 1; tempVestingPeriods += vestingPeriods; } } return disbursements; }

### Mobile Software Engineer at Nest was asked...

Feb 5, 2016
 Given a tree with potentially multiple child nodes, write an algorithm that describes how you would completely reverse (or mirror image) the tree. That is, given a tree with a root node of A and three children, BCD, and two children of B named EF, he wanted to generate a new tree that looked like a root node of A, then DCB with "FE" being the reversed children under B.2 AnswersI started writing down a function that walks down the nodes while building an array. E.G. the above tree would convert to: A0 B1 E2 F2 C1 D1 I'd then walk that array by level, starting with the last entry for each level. E.G. level 0 is A, level 1 would print out D, C... and before B prints out, I'd print out the children for B on level 2. I only had perhaps between 7 - 10 minutes to scribble out the concept on the white board and I don't think I was able to adequately flesh out my thoughts, so if I had to hazard a guess as to why I got rejected from the job, it would have been because I didn't impress this hiring manager.void reverseTree(Node root) { if (root == null || root.children.length == 0) return; // Reverse children nodes, and recurse on those kids int start = 0; int end = root.children.length - 1; while (start <= end) { if (start == end) { reverseTree(root.children[start]); break; } Node tmp = root.children[start]; root.children[start] = root.children[end]; root.children[end] = tmp; reverseTree(root.children[start]); reverseTree(root.children[end]); start++; end--; } }

### Mobile Software Engineer at NortonLifeLock was asked...

Jan 29, 2013
 given a matrix where the numbers ascend both in rows & columns, e.g. 1 3 5 7 9 11 13 15 18 20 22 24 26 28 30 31 33 36 38 39 42 44 47 49 50 If you're asked to write a function that provides a boolean (YES or NO) answer to "does this number exist in this matrix", explain how you would design an algorithm to be most optimal. 2 AnswersI'm not 100% certain if that is the exact same style of matrix that was on the white board (I didn't scribble down my notes fast enough), so it may have been that some ascending numbers might be on the row above. E.G. 1 3 5 7 9 11 13 15 18 25 22 24 26 29 30 where 25 is on row 2 and 22 is on row 3. After some hand wringing and a bit of stress, the questioner dropped a hint that I could look at the beginning and end of a row and rule it out immediately if the beginning and end didn't have the desired number in range. I'm guessing they wanted a much more specific answer than this though, along with big / little O complexity time.Start from the right-top. Keep going left till our number is greater than the number at [row,col]. Once this col is found, increment the row and move down, Repeat until found.

### Mobile Developer at Pocket Gems was asked...

Feb 20, 2012
 You are in a game of Russian Roulette with a revolver that has 3 bullets placed in three consecutive chambers. The cylinder of the gun will be spun once at the beginning of the game. Then, the gun will be passed between two players until it fires. Would you prefer to go first or second?2 AnswersWould go First as Probability for winning is 4/6.Imagine a 6 chamber gun with chambers labeled A through F in a circular fashion. Chambers A, B, and C have the bullets (remember the bullets are placed consecutively). If the first shot is from chambers A, B, or C, Player 1 dies/loses. If chamber D is first, Player 1 will win. If chamber E fires first, Player 1 will die/lose once the gun is passed back to him at chamber A. So overall, Player 1 has a 4/6 chance of dying, and Player 2 has a 2/6 chance of dying. Therefore, I would prefer to go second.
110 of 439 Interview Questions