Is it okay to use StringBuilder.reverse() in Java?


  • 2
    S

    For Java, I assume using StringBuilder.reverse() rather than a loop would make the code shorter and readable. However, is that usually allowed for an interview question like this?


  • 1
    D

    do not think so.... that is also time-consuming, and you will have a time limit excess for a long input string.


Log in to reply
 

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