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.
You are right, I think yours perfomance would be better than mine. But just FYI, as far as mutables go, StringBuilder is faster than StringBuffer (because StringBuilder is not synchronized). General rules are not to use StringBuffer if only one thread is involved. Because lots of locking and unlocking code for synchronization will unnecessarily take up CPU time.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
You are right, I think yours perfomance would be better than mine. But just FYI, as far as mutables go, StringBuilder is faster than StringBuffer (because StringBuilder is not synchronized). General rules are not to use StringBuffer if only one thread is involved. Because lots of locking and unlocking code for synchronization will unnecessarily take up CPU time.