An escape game requires that players solve various puzzles to obtain objects that will aid them in escaping. In one such

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

An escape game requires that players solve various puzzles to obtain objects that will aid them in escaping. In one such

Post by answerhappygod »

An Escape Game Requires That Players Solve Various Puzzles To Obtain Objects That Will Aid Them In Escaping In One Such 1
An Escape Game Requires That Players Solve Various Puzzles To Obtain Objects That Will Aid Them In Escaping In One Such 1 (38.09 KiB) Viewed 72 times
An escape game requires that players solve various puzzles to obtain objects that will aid them in escaping. In one such puzzle, players are given an array of integers and a set of rules to follow in order. Here are the instructions given to the players: "Given an array of integer values, maximize the points earned using the following method: 1. Choose a value v. Delete all elements of that value and add their sum to the points. 2. Delete all elements equal to v+1 or v- 1 for no points. 3. Repeat steps 1 and 2 until there are no more elements in the array. Calculate the maximum number of points that can be achieved by following these rules for an array of values. Example elements = [5, 6, 6, 4, 11] Delete 11 for 11 points. Since there are no elements equal to 11-1= 10 or 11 + 1 = 12, proceed with the remaining elements: [5, 6, 6, 4]. Delete the two 6's for 12 more points. Delete any elements equal to 6-1=5 or 6+1=7. Then proceed with the remaining elements: [4]. Finally delete the 4 and add 4 points for total points 11 + 12+ 4 = 27. Function Description Complete the maxPoints function in the editor below.. maxPoints has the following parameter(s) int elements[n]: an array of integers Returns long int: the maximum number of points that can be earned
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply