.
- pythonic
s[::-1]
- recursive (memory limit exceed)
- swithch fisrt and last
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = “hello”, return “olleh”.
Soulution:
1 | class Solution: |
1 | class Solution: |
s[::-1]
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = “hello”, return “olleh”.
1 | class Solution: |
1 | class Solution: |