Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2272. Substring With Largest Variance
Find the maximum possible difference between counts of any two lowercase letters over all contiguous substrings of s — i.e., the largest (count(a) - count(b)) achievable in any substring. Key idea/pattern: treat each ordered pair of distinct letters and run a Kadane-like linear scan to maximize the difference while ensuring both letters appear in the substring (|s| up to 10^4).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.