## jatin085

I dare you ask the same question to interviewers :) Imagine that you are simulating a zoo game on computer. What will you like to add to your zoo app apart from the problem statement? What features would you provide to the player? How you will structure your application code to accomplish that?

- jatin085 February 09, 2015Looks good. I think random number generation more appropriate. Say if rand() returns a floating point numbers between 0.0 to 1.0, if (0.1 <= value < 0.15) we redirect to p3.html and so on. In your case, there will be a situation when user will refresh p1.html 65 times before he skips p5.html.

- jatin085 April 20, 2014Itcecsa, the question is not clear. It can have many meanings. Did they ask to keep a running list of top 10 items purchased in last one hour with new purchases constantly being received through stream? Or is the list already stored in a file or database and you are asked to write a query to list top 10 items. Please add more details.

- jatin085 April 20, 2014@abhijeet15oct, if arr[midx][midy][midz] < d, we still eliminate just the 1/8th upper cube, any element in rest 7/8th of matrix can be less than d. Anyway, your solution takes 7^(log(max(x,y,z)) time which is not acceptable. Also if start values are 0 and end values are 1, mids are all 0s and we call functions with same arguments recursively so this is infinite recursion. Stack overflow.

- jatin085 April 07, 2014The 3D matrix is sorted on each row, column and depth. But in the example you gave, every element in next plane is assumed to be greater than elements of previous plane, which is incorrect. Actually if I take your assumption, I could solve the problem in O(log(n)) time. O(n) is very bad. In O(n) time, I could've checked each and every element in 3D matrix and compared it with the given number.

- jatin085 February 28, 2012**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

Tries are constructed incrementally upon inserting new elements. We do not need to pre-allocate 26^10 (or 1 PB) of memory to support usernames of length 10 letters.

- jatin085 February 09, 2015