1# in order to make a string reversed in python
2# you have to use the slicing as following
3
4string = "racecar"
5print(string[::-1])
6
1function reverseString(str) {
2 return str.split("").reverse().join("");
3}
4reverseString("hello");
1#linear
2
3def reverse(s):
4 str = ""
5 for i in s:
6 str = i + str
7 return str
8
9#splicing
10'hello world'[::-1]
1String str = "Hello";
2String reverse(String str){
3 StringBuilder sb = new StringBuilder();
4 sb.append(str);
5 sb.reverse();
6 return sb.toString();
7}