3 ms·
Shortest way to reverse a string in programming languages
My vote goes to Python: [::-1]
Can your's do better? Better here is "shorter"
- dalke 12y agoAs usual, APL wins: ⌽'string' . In J that's |.'string' . See http://rosettacode.org/wiki/Reverse_a_string http://rosettacode.org/wiki/Reverse_a_string for plenty of other examples.
- aligajani 12y agoInteresting, how would one go about finding ⌽ on a keyboard.
- boo_radley 12y agoIn the usual way, of course.
- JCJoverTCP 12y agoif length of the string is 1, this may shorten some answers, no?