Company: Amazon_17oct
Difficulty: medium
System Stabilization Time A large distributed system routes every request through a chain of service nodes called a pipeline. A pipeline is stored as a string in which each character is the category of one service node (for example authentication, video streaming or storage). Because of a bug, one category of service, given by the character failed_service , starts disrupting the pipeline. Every second, every node of category failed_service terminates the node immediately before it in the current pipeline. All nodes terminated during that second are removed together at the end of the second, and the next second starts from the shortened pipeline. A failed_service node at the very front of the pipeline has no node before it and terminates nothing. Nodes of category failed_service can themselves be terminated by a failed_service node right after them. The pipeline is stable once a second would terminate no node at all. Its stabilization time is the number of seconds in which at least one