Question: This is an interview question. In other words, it is your time to explore and feel what to expect in a job interview. For this

This is an interview question. In other words, it is your time to explore and feel what to expect in a job interview. For this question, you have a garden that is represented by a 2D array, and we are placing a hungry rabbit in the middle of the garden. The values of the array represent the carrot count that is available for the rabbit in each square within the garden. In case the garden does not have an exact center, the rabbit begins in the square that is closest to the center with the highest carrot count. On a given turn, the rabbit will eat the carrots that are available on the square he is on, then the rabbit moves up, down, left, or right choosing the square that has the highest number of carrots. If there are no carrots left on any of the adjacent squares (i.e., up, down, left, or right), the rabbit will go to sleep. You may assume that the rabbit will never have to choose between two squares with the same number of carrots. Your program must have a function that takes a garden matrix and returns the total number of carrots the rabbit eats. The matrix cannot be populated with negative integers. As a note, you must have the array within your program. In other words, the program should not ask the user to input an array. You must test your program with the following array. You will lose 20% of your score if you dont test the program with the following array. 10159764321121223416781000176253602349051214244222216116255069853761261231020689142213159654110121021 Submission You must submit your complete code along with a screenshot showing that you tested your program with the matrix above. Your code must be in C++, or you will get zero. Additionally, you must provide a .cpp or .txt file for me to be able to copy your code and run it.**Needs to be in C++
And the total carrots eaten by the rabbit should be 91 carrots

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!