Welcome to LeetCode Discuss.
This is a place to ask questions related to only OJ problems.
Please read the FAQ to help yourself making the best use of Discuss.
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?
do not think so.... that is also time-consuming, and you will have a time limit excess for a long input string.