← All problemsSign in

3777. Minimum Deletions to Make Alternating Substring

LeetCodeStringSegment TreeOpen on judge ↗

You are given a string s of length n consisting only of the characters 'A' and 'B'. You are also given a 2D integer array queries of length q, where each queries[i] is one of the following: - [1, j]: Flip the character at index j of s i.e. 'A' changes to 'B' (and vice versa). This operation mutates s and affects subsequent queries. - [2, l, r]: Compute the minimum number of character deletions

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