Delete and Earn

Maximize Score (Delete and Earn)

Given an integer array nums, you may repeatedly perform the following operation until the array is empty or you choose to stop:

  • Choose a value x and earn x...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: