Ensure Non-Zero Load Sum
Amazon SQS is a completely operated platform in the AWS ecosystem that enables dispatchers to submit and receivers to collect messages. Each message present in the sequence is symbolized by an integer, where a positive number indicates a submission by a dispatcher and a negative number denotes a retrieval by a receiver. The behavior of the queue is controlled by the "processing burden," calculated as the cumulative sum of message values over any consecutive group of messages.
To guarantee the queue's consistent operation, it is essential that the processing burden for any contiguous block of messages is never zero. A processing burden of zero would signify that the queue has lost its functional purpose, which is an undesirable sadness... :(
As a sharp software engineer with a total compensation of 💰 1.5M USD💸, your objective is to compute the least number of additional messages that must be injected into the sequence. Each added message may carry any integer value. The intention is to ensure that once these are inserted, no segment within the sequence yields a total processing burden of zero.
Given the array queueMessages, determine the minimal count of insertions necessary to fulfill this requirement.