Method 1 - String Builder / String Buffer
// Using String builder and String buffer
public class Method1 {
public static void main(String...
For further actions, you may consider blocking this person and/or reporting abuse
Talk about over complicating things (for JavaScript at least)
Job done!
Also you could have at least used JavaScript if you were going to use the JavaScript tag, may I suggest you remove the JS tag from the post as beginners may be really confused and even experienced developers would probably have a few head scratches over trying to convert things like
Stack<Character> charStack = new Stack<Character>();to JS (I mean I can't even work out what the equivalent would be as I don't know that utility in Java)!I am removing that :)
Wait, it is not JavaScript. I think you put wrong tag.
But it may help JS developers also, as only syntax change :)
You could implement this in almost every language.