Algorithm · ByteDance · Easy
You are given a string s. When characters are compared, uppercase and lowercase forms of the same letter count as identical. Return how many neighboring positions in s have characters that are not equal under this case-insensitive comparison. Formally, count every index $$i$$ with $$0 \le i < s - 1$$ such that the letters at i and i + 1 differ after case folding. If s has fewer than two characters, the answer is 0. Example 1: Explanation: Case-folding gives aabbcc; the only…
Checking your access…