Question: Please help to solve this simple coding problem, thanks! This coding problem can use any programming languages, Python or jave both okay Description: You've recently

Please help to solve this simple coding problem, thanks!

This coding problem can use any programming languages, Python or jave both okay

Please help to solve this simple coding problem, thanks! This coding problem

can use any programming languages, Python or jave both okay Description: You've

recently started managing a theme park but have run into a problem:

Description: You've recently started managing a theme park but have run into a problem: You're never sure if the park is empty or not when it's time to close for the night. Your equipment is so bad, you're not even sure your records are correct! You will be provided with an array of positive and negative integers representing a record of the comings and goings of groups inside the park for the day. Each integer represents the party size of a group either entering (positive) or exiting (negative) the park. Groups never split up or combine, and a valid record will never show a group leaving the park before they enter. In order to close the park for the day, you need the park to be empty. Write a function that returns 'CLOSE' if the park can safely close or 'OPEN' if there are still people in the park or the record is invalid. Note: Group sizes are not unique. There can be multiple parties of the same size in the park Examples: Input: [2,5,7,2,6,5] Output: 'OPEN' Explanation: 'A group of 5 and 6 left the park before entering, so this is an invalid log and the park must remain open.' Input: [9,9,8,8,9,9,9,9] Output: 'CLOSE' Explanation: ' 'The groups weren't unique, but all groups that entered the park have left. The park may close.' Language Python 3 (i) Q Au

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!