Adobe Interview Question for Software Engineer / Developers






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

n X n Array.
Each box having either of the following:
1. 0 if it is empty and snake can move.
2. 1 if snake's body is in that box.
3. 2 if box is the snake food (using which snake grows)
4. 3 if there are any walls.

Need 2 objects to store the start and end location of the sanke.

- Ashok February 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

if your snake is going zigzag and touching itself, how will you find out in which direction the tail should shorten? E.g.

v- tail
  XXXXXX
       X
       X
   XXXXX
   XXXXX
   XXXXX
   XXXXXXXX <-- head

In the blob at the end..how do you know if the snake went

.---'
   `---.
   .---'
   `------| <-- head

versus

/\/\|
   |||||
   |\/\/
   '------| <-- head

Instead...how about have 0 for empty space, -1 for apple, -2 for wall, and each part of the snake has a value that counts up? e.g. the first part of the snake is 1, then 2, 3, 4,...50,51,...99,100. to erase then just check surrounding boxes for the box with the next highest digit and erase.

you will need to take into account the values getting too large, though, and will need to find an appropriate time to reset the values. (if you're storing ints in the array...you will be able to move ~2million spaces before this happens, though).

- woohoo March 01, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Good point. I think storing snake's body with increasing numbers instead of all 1's should solve this problem.

- Ashok March 01, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about using a Linked List. Each node have its coordinate.
I implemented it some time back.

- Anonymous March 01, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yes..this looks better

we can maintain a singly linked list with head and tail pointers containing coordinates in the nodes with new coordinates added at the head and deleted at the node. but first we need to create a 2d array of the map specifying special values indicators of food,wall,free,collision condition
1. food - add a new node at the head with food coordinates (length of the snake increases)
2. wall - hit wall, break out
3. free - add node at the head with free coordinates and hence updating the free coordinate status to collision and also delete the node at tail and hence updating the tail coordinate status to free ( length of the snake remains same)
4. collision - signifying that the current coordinate is in the cirrent list and hence collision of snake to itself. break out

so we start creating a list by adding a free coordinate at start into the linked list and wait for user next direction. we check the next coordinate from the map status and hence updata the list or map accordingly.

- fabregas March 11, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

find adobe written test questions

www dot testskillshome dot com/?s=adobe

- Indian March 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can use use a singly link list
the structure of the link list will be:
struct node{

- Anonymous July 13, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

We can use use a singly link list
the structure of the link list will be:
struct node{
node *next;
int direction;//up=0,down=1,right=2,left=3
int x;
int y;
}

this will be the structure of one node of the snake.
direction will specify that in which direction this snake is moving

- runner July 13, 2011 | Flag Reply


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