← All problemsSign in

3442. Maximum Difference Between Even and Odd Frequency I

LeetCodeHash TableStringCountingOpen on judge ↗

You are given a string s consisting of lowercase English letters. Your task is to find the maximum difference diff = freq(a1) - freq(a2) between the frequency of characters a1 and a2 in the string such that: - a1 has an odd frequency in the string. - a2 has an even frequency in the string. Return this maximum difference. Example 1: Input: s = "aaaaabbc" Output: 3 Explanation: - The char

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