# Questions d'entretiens - Mobile engineer

# 2 k

Questions d'entretien pour Mobile Engineer partagées par les candidats## Principales questions d'entretien

### 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 << 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 réponses↳

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? Moins

↳

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

### 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 réponses↳

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 Moins

↳

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).. Moins

### 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?

4 réponses↳

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 ? Moins

↳

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 Moins

↳

Stupid Math this is called stalking not algorithm

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

3 réponses↳

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". Moins

↳

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

↳

The answer should be a right angle.

### Implement Integer.parseInt from scratch

3 réponses↳

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 Moins

↳

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 Moins

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

3 réponses### 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 réponses↳

^ 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". Moins

↳

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

↳

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 réponses↳

class Solution{ int ans[] = new int[1]; //O(n) public int efficientDia(TreeNode root) { if(root == null) return 0; int left = efficientDia(root.left); int right = efficientDia(root.right); ans[0] = Math.max(ans[0], 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[0] < 1 + leftHeight + rightHeight) { ans[0] = 1 + leftHeight + rightHeight; } return Math.max(getDiameter(root.left), getDiameter(root.right)); } Moins

↳

int ans[] = new int[1]; //O(n) public int efficientDia(TreeNode root) { if(root == null) return 0; int left = efficientDia(root.left); int right = efficientDia(root.right); ans[0] = Math.max(ans[0], 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[0] < 1 + leftHeight + rightHeight) { ans[0] = 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; } Moins

↳

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 Moins

### 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 réponses↳

public void printNumbers () { for (int i = 1; i <= 100; ++i) { if (i % 3 == 0 && 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); } } } Moins

↳

public void printNumbers () { for (int i = 1; i <= 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); } } } Moins

### Programming Question: Jay has N friends, there are M different type of tickets. Jay & his friend, each have some tickets ticket[i]. ticket[N] is the number of tickets Jay has. WAP to return the number of friends who's number of tickets are different from jay's ticket count with 'k'. input: 1. N - number of Jay's friends 2. M - different type of tickets 3. k - difference required 4. Array of tickets

2 réponses↳

Yes, Partial test case passed.

↳

Answer in JS- Trying to remove the duplicate tickets for each person then compare the tickets to get the desired number k. And then get the number of such friends. Not comparing Jay's own tickets. const getFriendsCount = (N, M, k, ticketsArr) => { const uniqueTktsArr = ticketsArr.map(tktsArr => Array.from(new Set(tktsArr))) let friendsNum = 0 const jaysTickets = uniqueTktsArr[N] uniqueTktsArr.forEach((tktsArr, i) => { if (i === N) { return true } let match = 0 tktsArr.every(tkt => { if (jaysTickets.includes(tkt)) { if (++match === k) { friendsNum++ return false } } return true }) }) return friendsNum } Moins