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.
So the answer to "ab" is 2? (Yes, it is, I had the chance to find it out for 5 hackos.)
As you write, if the string only has one character, or boils down to one char after deleting all the repeating ones, the answer should be 0. This was not clear from the text, I first thought in such case the answer should be 1.
Then I thought the answer is 0 because I didn't delete anything. From the wording it was not clear whether it is obligatory to delete at least one character, or it's ok not to delete anything. It cost me again 5 hackos to understand that I was wrong. :-(
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Two Characters
You are viewing a single comment's thread. Return to all comments →
So the answer to "ab" is 2? (Yes, it is, I had the chance to find it out for 5 hackos.) As you write, if the string only has one character, or boils down to one char after deleting all the repeating ones, the answer should be 0. This was not clear from the text, I first thought in such case the answer should be 1. Then I thought the answer is 0 because I didn't delete anything. From the wording it was not clear whether it is obligatory to delete at least one character, or it's ok not to delete anything. It cost me again 5 hackos to understand that I was wrong. :-(