Replace Every Nth Consonant

Problem Overview

  • Transform a message by replacing every nth consonant with the next consonant, preserving case and wrapping z/Z to b/B.
  • Input: string message and integer n; Output: the modified string; non-consonants remain unchanged; time complexity should be no worse than O(message.length^2).
  • Consonants use the standard English set (b, c, d, f, ..., z), counted across the string.
  • Asked in Meta coding interviews, this interview question focuses on text processing; a practical string manipulation problem.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: