stringbuffer is thread safe while stringbuilder is not and hence fast. We don't need to consider thread safety for this problem. So better to use stringbuilder. that's my understanding, any other opinion here?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.