Determine Rounds for Star Substring Threshold
AmazonSoftware Engineer · Online AssessmentLast 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.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.