Get Max Charge
Asked in Amazon interviews, this coding interview problem gives an array of charges (positive, negative, or zero). You can remove any non-end element, causing its left and right neighbors to merge into one with summed charge. Determine the maximum achievable charge after any sequence of such removals and return it as a long. A concise interview question on array transformations.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
