Problem Statement
Class name: MuseumTour Method name: mostImpressiveTour Parameters: int[] Returns: int Joe is a museum guide. Over the years, he observed that visitors are impressed only by the quantity of the art they see, disregarding all other properties of the art. Additionally, Joe observed that visitors are impressed most when the number of pieces of art increases as they go from one exhibition room to the next. Joe's museum has a very simple layout - it is a long hallway with sequentially numbered exhibition rooms on one side. During the tour, Joe takes tourists to exhibition rooms in increasing sequential order, possibly skipping some of the rooms. Given the number of pieces of art in each exhibition room, Joe must plan the most impressive tour that satisfies the following criteria: *The order of the tour must be in increasing sequential order. *The number of pieces of art in each subsequent room of the tour must be greater than the number of pieces of art in the preceding room *The count of pieces of art on the tour must be the highest among all possible tours that satisfy the first two criteria. Implement a class MuseumTour, which contains a method mostImpressiveTour. mostImpressiveTour returns the number of pieces of art on the most impressive tour, as defined above. The method signature is (be sure your method is declared public): int mostImpressiveTour(int[] artPerRoom); *int[] artPerRoom contains between 1 and 50 elements, inclusive, representing the number of pieces of art in a given room of Joe's museum. *artPerRoom is ordered according to exhibition room's sequential number. *All elements of artPerRoom are positive numbers not exceeding 300. Examples: - If artPerRoom=[1, 2, 3], mostImpressiveTour returns 1+2+3=6. - If artPerRoom=[3, 2, 1], mostImpressiveTour returns 3. - If artPerRoom=[100, 1, 2, 3, 4, 5], mostImpressiveTour returns 100. - If artPerRoom=[50, 100, 60, 70, 80], mostImpressiveTour returns 50+60+70+80=260.
Definition
- Class:
- MuseumTour
- Method:
- mostImpressiveTour
- Parameters:
- int[]
- Returns:
- int
- Method signature:
- int mostImpressiveTour(int[] param0)
- (be sure your method is public)
Constraints
Examples
No public sample cases were explicitly marked for this problem in the original data.