Need help with this!

Bob the Adventurer is one step away from solving the mystery of an ancient Mayan tomb. He just approched the secret chamber where the secret Mayan scriptures are locked in a chest There are N ancient statues in the room. After long thought, Bob figured out that in order to open the treasure chest he needs to stand in the middle of the room and hit every statue with a laser ray at the same time. Bob is a highly experienced adventurer, setting multiple laser rays at the same time SO is not a problem for him. Moreover, every ray that he creates is perfectly straight and never changes direction at all The middle of the room, where Bob is standing, has coordinates (0, 0). Every statue is located at some point with coordinates (x, y). Each statue is made of pure glass, so that if any ray hits it, it does not stop, but goes through the statue and continues beyond in the same, unchanged direction. Bob wonders how he can hit every ancient statue in the room using the fewest rays possible. Assume that the following declarations are given: // Point2D obj is an Object with attributes // obj.x – type: int // obj.y type: int – Write a function function solution(A); that, given minimal number of rays that Bob must set in order to hit every statue in the room. an array of points A, representing the locations of the statues, returns the For example, given an array A A[ 0.y A[ 1.y A[2].y A[ 3].y = A[4] y = -2 (statue 0) 2 (statue 1) 4 statue 2) A[01.x A[1].x A[2].x A[3].x = -3 A[4].x = = -1 1 = 2 = = 2 (statue 3) = -2 (statue 4) 2 your function should return 4 1,2 As is shown in the image, it is possible to create four rays in such a way that: the first will hit statue 0; the second will hit statues 1 and 2; the third will hit statue 3; the fourth will hit statue 4 Show transcribed image text Bob the Adventurer is one step away from solving the mystery of an ancient Mayan tomb. He just approched the secret chamber where the secret Mayan scriptures are locked in a chest There are N ancient statues in the room. After long thought, Bob figured out that in order to open the treasure chest he needs to stand in the middle of the room and hit every statue with a laser ray at the same time. Bob is a highly experienced adventurer, setting multiple laser rays at the same time SO is not a problem for him. Moreover, every ray that he creates is perfectly straight and never changes direction at all The middle of the room, where Bob is standing, has coordinates (0, 0). Every statue is located at some point with coordinates (x, y). Each statue is made of pure glass, so that if any ray hits it, it does not stop, but goes through the statue and continues beyond in the same, unchanged direction. Bob wonders how he can hit every ancient statue in the room using the fewest rays possible. Assume that the following declarations are given: // Point2D obj is an Object with attributes // obj.x – type: int // obj.y type: int – Write a function function solution(A); that, given minimal number of rays that Bob must set in order to hit every statue in the room. an array of points A, representing the locations of the statues, returns the

For example, given an array A A[ 0.y A[ 1.y A[2].y A[ 3].y = A[4] y = -2 (statue 0) 2 (statue 1) 4 statue 2) A[01.x A[1].x A[2].x A[3].x = -3 A[4].x = = -1 1 = 2 = = 2 (statue 3) = -2 (statue 4) 2 your function should return 4 1,2 As is shown in the image, it is possible to create four rays in such a way that: the first will hit statue 0; the second will hit statues 1 and 2; the third will hit statue 3; the fourth will hit statue 4

## Expert Answer

Answer to Bob the Adventurer is one step away from solving the mystery of an ancient Mayan tomb. He just approched the secret cham…