↳

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

↳

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

Er werd een Mobile Software Engineer gevraagd...15 september 2015

↳

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 Minder

↳

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

Er werd een Mobile Software Engineer gevraagd...5 februari 2016

↳

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

↳

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 Minder

↳

Stupid Math this is called stalking not algorithm

Er werd een Mobile Software Engineer gevraagd...24 januari 2013

↳

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

↳

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

↳

The answer should be a right angle.

Er werd een Software Engineer Mobile gevraagd...4 augustus 2011

↳

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 Minder

↳

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 Minder

Er werd een Mobile Developer gevraagd...20 februari 2019

↳

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

↳

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

↳

This can be calculated with a simple recursive Fibonacci

↳

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)); } Minder

↳

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; } Minder

↳

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 Minder

Er werd een Software Mobile Engineering gevraagd...2 december 2010

↳

I think the point is, hash tables are generally fairly empty, to increase search times so they take up a lot of memory space, but with a binary search tree, the information is very dense, so it would take up less space. Minder

↳

Yes they ask you which takes up less memory and there are multiple answers due to the number of elements (as you've stated) as well as the type of the data being stored. A hash table would be better if there aren't many elements since you typically have more slots than you have actual elements so you aren't resizing on every insert. Similarly if you're storing larger object say of 64 bytes, then the extra pointer data stored in a basic tree doesn't amount to much in comparison. However if you're storing something like a character or even a 32-bit integer, a binary tree will take more space since each node (in a basic implementation) needs to store (assuming 32-bit pointer) 64-bits with of pointers per element. Point is the question is stupid without further information since the answer depends on information they don't give you. But they do expect you to use a binary tree. Minder

↳

If minimizing memory footprint is the only requirement, I would use nothing, since nothing doesn't take up any memory and satisfies the functional requirement. Are you asking me which of these takes up less memory? That depends on the number of elements in the storage. But usually, a hash-table has less memory overhead Trees have overhead associated with every node. Minder

Er werd een Mobile Developer gevraagd...16 februari 2015

↳

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); } } } Minder

↳

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); } } } Minder

Er werd een Mobile Software Engineer gevraagd...17 november 2016

↳

dispatch queues manage the tasks you provide to GCD and execute those tasks in FIFO order. Types of dispatch queues include serial, concurrent and the main dispatch queue (where the UI happens). Minder

↳

In these sorts of interviews you really need to drill down and understand what the interviewer is looking for. A good way to simulate a real interview experience is to do a mock with one of the Envoy Mobile Software Engineer experts on Prepfully, rated super strongly on TrustPilot... prepfully.com/practice-interviews Minder