← 返回 amazon 的题目列表Mutation Removal in Genome
类型:online_judge
Given a string genome representing the nucleotides in an organism and a character mutation representing the mutated nucleotide. The task is to determine the earliest time after which no removals are possible.
Example:
If genome = "luvzliz" and mutation = 'z', the process of removal is described as following:
The mutated nucleotide removes the other nucleotides to its left, removing one nucleotide at a time per unit time until no more removals are possible. Return the earliest time.
Input
A string genome and a character mutation.
Output
An integer representing the time after which no more nucleotides can be removed.
Example
Input: genome = "aa", mutation = 'a' Output: 1
Input: genome = "luvzliz", mutation = 'z' Output: 3
Example
Input
luvzliz
z