##
Smallest length string with repeated replacement of two distinct adjacent
April 25, 2017

Given a string of any combination of three letters ‘a’, ‘b’, and ‘c’, find length of the smallest string that can be obtained by applying the following operation repeatedly: Take any two adjacent, distinct characters and replace them with the third. Examples: Input : cab Output : 2 We can select any two adjacent letters,… Read More »