This is a verified interview question from De-shaw. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Maximize Prizes" covers key patterns like Strings.
"An engineer participated in a lucky draw event where each participant is given a string of uppercase English letters. These strings represent the sequence of draws. A sequence "AMZ" in your string means you win a prize. However, the event organizers have given the engineer a special opportunity. The engineer is allowed to add at most one uppercase English letter to his string at any position to increase his chances of winning. The task is to determine the maximum number of prizes that can be won (i.e., the maximum number of "AMZ" subsequences) by optimally adding the additional letter.  Note: A subsequence of a string is a string that can be created by deleting zero or more characters in the original string while maintaining the original order. For example, "abc" is a subsequence of "abcd" but not a subsequence of "bacd"."
Join thousands of developers practicing for De-shaw.