CISCO coding Q2
Anonymous User
595

You are given a string and you have to tell number of operations to remove them all
you can remove continuous duplicate at once
example:
input : "aabbaa"
output : 2
first we remove bb then the string becomes aaaa, now we can remove all these at once to total 2 operations
example 2:
input : "abab"
output : 3
we remove suppose a then left with bab
now we remove a again and left with bb
then we remove bb at once to total operation = 3
example 3:
input: "abc"
output : 3
Can anybody tell me the solution how to solve this Please.

Comments (9)