Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Different formulas for mathematical core areas.

Answered: 1 week ago

Question

The amount of work I am asked to do is reasonable.

Answered: 1 week ago

Question

The company encourages a balance between work and personal life.

Answered: 1 week ago