Available question text
Map each character in s to an integer value (use vals when the char appears in chars, otherwise its 1-indexed alphabet position). Then find the maximum contiguous subarray sum (empty substring allowed, so result ≥ 0) — solvable with Kadane's algorithm in O(n).
Related questions
Continue with questions that share topics or the same question type.
- Build Array Where You Can Find The Maximum Exactly K Comparisons
Coding
- Find and Count Maximum-Score Grid Paths
Coding · Dynamic Programming · Grids & Matrices
- Find Longest Awesome Substring
Coding
- Find Longest Self-Contained Substring
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2606. Find the Substring With Maximum Cost
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source