Google Interview Question for Software Engineer / Developers


Country: United States




Comment hidden because of low score. Click to expand.
1
of 1 vote

I think the interviewer wanted you to understand that an array must be contiguous and not a linked list. That is, you must have capacity, which is the amount of memory allocated, and size, which is the actual size of the array. So, when the user resizes the array with size > capacity, you must reallocate memory and copy the values from the old to the new array.

- Dídac Pérez December 08, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

I think what they mean is a pointer to pointers implementation?

- Allan Jabri November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

that would means a LinkedList which is not an array[]

- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> November 16, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Well, an array is a pointer to memory is it not? To implement the array class, you would just need some sort of interface for dereferencing pointers in an incremental way. As in a[0] = *p, a[1] = *(p+1), etc

- ajabri November 17, 2013 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

If you cannot use a simple array like
String[] or Object[] or E[]
then the question would be more like create an array implementation on the JVM an not in JAVA.

In Java there is a class called Arrays, which is a utility class to deal with regular arrays ( sorting, copying, etc etc etc)

The only thing you can do ( as far as I can think ) is to implement any Data Structure such as Vector, ArrayList, Stack, Queue even a tree using a regular array ( Object[] )

Another thing to point out is that, in java we cannot extends from Object[] even if arrays are treat like Objects. This is not allow. so that is not the way to go.
The last resource we have instead would be using native methods and try to implement something in C on a DDL or something. But I am running out of ideas.

Anybody?

- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Array is incremental index from 0 to n, and gives constant time access by index.
Thus implement HashTable with key as index and value as whatever stored in array.

- krutik January 29, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Maybe you should implement linked list based on something like that:

class Node {
	Node prev;
	Node next;
	Object value;

- glebstepanov1992 November 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Then the question would be: Implement a LinkedList or a doubleLinkedList or just a anything from the List Interface.

We need to clarify this. I dont think is that simple

- .·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> November 16, 2013 | Flag
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Mind your business Anonymous moron

- sivaji8 November 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 votes

You can't say this to interviewer. By the way I asked for Array and not ArrayList.

- undefined November 15, 2013 | Flag
Comment hidden because of low score. Click to expand.


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More