Adobe Interview Question for Software Engineer / Developers






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

Use an array.
1. If an index is beginning or end of a snake or a ladder, put the destination number at that location. (number less than index means snake, number greater than index means ladder).
2. All other array indexes can be put 0.

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

Abt the above ans. if the index is the beginning only then put the destination in that location. Not at the end.

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

1. Use an array representation of 1..100
2. each a[i] contains value (i+1) if no snake or ladder is there
a[i] contains the value > i and the value pointed by the ladder; if a[i] has a ladder starting
a[i] contains value < i; if a[i] is a snake mouth

3. Create the above array depending on the board structure.
4. Generate two random numbers MOD 100 and use them to take a chance

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

we can implement it by considering each point as a structure which will have the following variables:
struct point{
int x;
int y;
bool ladderstarting;
int ladder_x,ladder_y;
bool snakestaring;
int snake_x,snake_y
};

by using the following data structure we can implement the snake n ladder game easily.


in the main function we can declare an array of size 100 of this structure like this:
point game[100];

then for each n every point we will define it's property.

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

Hi,

I think it is better to use HashMap (in java) to store only those points of the game which has either snake or ladder at that point. The key of the hashmap will be the number and the value will be the destination. For e.g., if there is a ladder at number 25 which takes the user to number 60, then in the HashMap we can store 25 as key and 60 as value. If there is nothing (neither ladder nor the snake), that number is not included in the HashMap. This saves a lot of space.

- Tanuj Batra March 20, 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