Friday, April 24, 2015

HackerRank::Algorithms::Strings::Alternating Characters

    We need to have a look at a single deletion, if there are 2 equal adjacent letters then surely one of them has to be deleted and no matter which one we chose to delete, the remaining string is going to be the same, so by simply counting the number of equal adjacent letters and deleting them will give us the final result.



No comments:

Post a Comment