We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Why this approach return 11 for input 'cbbabbc' as an example ?
Correct answer should be 12 in this case. (c, b, b, a, b, b, c, bb, bb, bab, bbabb, cbbabbc)
I think there is a bug in 3rd testCase as its only checking i-1, i and i+1.
There should be a recursive way to keep check n-1 and n+1 terms until they are matching or something like that, then start taking min of each of those.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Special String Again
You are viewing a single comment's thread. Return to all comments →
Why this approach return 11 for input 'cbbabbc' as an example ?
Correct answer should be 12 in this case. (c, b, b, a, b, b, c, bb, bb, bab, bbabb, cbbabbc)
I think there is a bug in 3rd testCase as its only checking i-1, i and i+1.
There should be a recursive way to keep check n-1 and n+1 terms until they are matching or something like that, then start taking min of each of those.