FastPrepReplace Every Nth Consonant
Problems/Replace Every Nth Consonant

Replace Every Nth Consonant

ZipRecruiter logoZipRecruiter● EasyFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three ZipRecruiter OA reports describe counting consonants only, replacing every nth one, the consonant alphabet with vowels skipped, keeping case, and z wrapping to b. We supplied limits and a function signature. One source has no employment label, while the others clearly say new grad.

You are given a string message and a positive integer n. Scan consonant letters in message order, ignoring vowels and nonletters.

Replace every nth consonant with the next consonant in the sequence bcdfghjklmnpqrstvwxyz. Preserve case, and wrap z to b. Leave every other character unchanged.

Function

replaceEveryNthConsonant(message: String, n: int) → String

Examples

Example 1

message = "CodeSignal"n = 3return = "CodeTignam"

S is the third consonant and becomes T; l is the sixth consonant and becomes m.

Example 2

message = "xyz"n = 2return = "xzz"

y is the second consonant and advances to z.

Constraints

  • 0 <= message.length <= 100000
  • 1 <= n <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Branch with the Most FilesCapital One · OACapital One interview questions
  • Robot Stops Left or Right (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
  • REST API: Highest International StudentsRippling · OARippling interview questions
  • Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
  • Filter Isolated Interior Signal BitsSEDEMAC · OA
  • Scale Ingredient QuantitiesUpstart · OAUpstart interview questions
  • Telephone Keypad String EncodingEpic · OAEpic interview questions
  • Count Invalid Log GroupsIBM · OAIBM interview questions
  • Count Case-Insensitive TripletsTikTok · OATikTok interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String replaceEveryNthConsonant(String message, int n) {
        // Write your code here.
    }

}
Checking account…