← All problemsSign in

3445. Maximum Difference Between Even and Odd Frequency II

LeetCodeStringSliding WindowEnumerationPrefix SumOpen on judge ↗

You are given a string s and an integer k. Your task is to find the maximum difference between the frequency of two characters, freq[a] - freq[b], in a substring subs of s, such that: - subs has a size of at least k. - Character a has an odd frequency in subs. - Character b has a non-zero even frequency in subs. Return the maximum difference. Note that subs can contain more than 2 distinct ch

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start