Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
866 views

All interview experiences for Google  can be found using the tag "google_interview_experiences" in the search bar.

Here is the link : https://www.desiqna.in/tag/google_interview_experiences

in Interview-Experiences by Expert (34,270 points) | 866 views

1 Answer

0 like 0 dislike

Problem statement:
You have a monopoly board, round say in the format of an array: GO -> 1, 5, 2, 9, 12, 4 this last link is assumed not in the array -> GO. Array contains 0, 1, 5, 2, 9, 12, 4.
Array values are penalty numbers. GO has 0.
Question 1.
The goal is to find the dice number to minimize the penalty. In the previous case the number is 1.
If, however, you have this: GO -> 1, 3, 4->GO the number is 4 as GO has penalty 0.

 

Solution.
Here I did it. A bit nervous, but managed to do it. Until I got my bearings it took me 20-25mins, which is way too long. This was relatively easy.

 

If board length is smaller than 6 return the length of the board.
If board length length is bigger, here just traverse the array from 1 up to 6(as we have max 6 dice numbers and GO is 0) and find the minimum value and the corresponding index. We agreed both that is the right solution.

 

Question 2.
Left with 15-20mins to do it.
Find the number of dice rolls with minimum penalty to reach GO.
In the first case, it would be 2, a 1 dice roll 1 and a 6. Total penaly 1.
Here, I have not managed to do it yet.

by Expert (34,270 points)