Katkat

Determine Rounds for Star Substring Threshold

AmazonSoftware Engineer · Online Assessment

Last updated

This question evaluates string-processing and algorithmic problem-solving skills, including handling incremental updates, counting substrings impacted by character replacements, and performance-aware simulation.

Question

Given a string S, an offset array O (replacement order), and an integer M, repeatedly replace S[O[i]] with ''. Determine the minimum number of rounds needed so that the count of substrings containing at least one '' is at least M.