3803. Count Residue Prefixes
You are given a string s consisting only of lowercase English letters. A prefix of s is called a residue if the number of distinct characters in the prefix is equal to len(prefix) % 3. Return the count of residue prefixes in s. A prefix of a string is a non-empty substring that starts from the beginning of the string and extends to any point within it. Example 1: Input: s = "abc" Output: 2
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.
Sign in to chat with the tutor and save your progress.
Sign in to start