Your question is Contiguous Subarray and Frequency Order. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
DP World processes numeric container-handling measurements and character-based event labels. Given an integer array and a string, find the largest sum of any non-empty contiguous subarray and list every character's frequency in the order that character first appears.
Implement max_subarray_and_frequencies(nums, text).
nums is a non-empty list of integers.text is a string containing printable characters. Every character, including spaces and punctuation, must be counted.max_sum: the maximum sum of a non-empty contiguous subarray of nums.frequencies: a list of two-element lists, where each element is [character, count], ordered by first occurrence in text.def max_subarray_and_frequencies(nums, text):