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.
I did something similar.Converted String to StringBuffers sb1 and sb2.
Upon iterating characters through sb1:
if the character is found in sb2,then change that character value in sb2 to some other value(say '/') so that it couldn't be found in further iterations.
This is essential as sb1 may have repeating characters.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →
I did something similar.Converted String to StringBuffers sb1 and sb2. Upon iterating characters through sb1: if the character is found in sb2,then change that character value in sb2 to some other value(say '/') so that it couldn't be found in further iterations. This is essential as sb1 may have repeating characters.