Sponsored
Use these hints if you're stuck. Try solving on your own first.
Create a new integer array where arr[i] denotes the value of character s[i].
We can use Kadane’s maximum subarray sum algorithm to find the maximum cost.
Solve with full IDE support and test cases