You are given an integer array flowers of size flowers[i] represents the beauty of the
A garden is considered valid if:
It contains at least
The first flower and the last flower in the garden have the same beauty value.
You want to produce a valid garden by removing zero or more flowers from the original array flowers while maintaining the relative order of the remaining flowers.
The beauty of a garden is the sum of the beauty values of all its flowers.
Return the maximum possible beauty of a valid garden.
Constraints:
flowers.length
flowers[i]
It is possible to create a valid garden by removing some (possibly none) flowers.
You are given an integer array flowers of size flowers[i] represents the beauty of the
A garden is considered valid if:
It contains at least
The first flower and the last flower in the garden have the same beauty value.
You want to produce a valid garden by removing zero or more flowers from the original array flowers while maintaining the relative order of the remaining flowers.
The beauty of a garden is the sum of the beauty values of all its flowers.
Return the maximum possible beauty of a valid garden.
Constraints:
flowers.length
flowers[i]
It is possible to create a valid garden by removing some (possibly none) flowers.