Fastest Code to Reverse a String

  • 0

    Hi All,
    I tried all the methods to reverse a string

    Using string builder - takes 6ms and beats 13.92% of java solutions
    Using String Buffer - takes 4ms and beats 33.80% of java solutions
    Two Pointer method Using XOR - takes 3ms and beats 55.46% of java solutions
    Two Pointer method - takes 2ms and beats 85.53% of java solutions

    but i want to know the solution which beats 100% :( and is at the top of the Leet code submission bar graph ??

    Please help guys
    PS: Please do not post code i have already mentioned.Sorry for the deceiving Post heading / :-E.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.