TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Shortest way to reverse a string in programming languages

2 pointsby aligajaniover 10 years ago
My vote goes to Python: [::-1]<p>Can your&#x27;s do better? Better here is &quot;shorter&quot;

2 comments

dalkeover 10 years ago
As usual, APL wins: ⌽&#x27;string&#x27; . In J that&#x27;s |.&#x27;string&#x27; .<p>See <a href="http://rosettacode.org/wiki/Reverse_a_string" rel="nofollow">http:&#x2F;&#x2F;rosettacode.org&#x2F;wiki&#x2F;Reverse_a_string</a> for plenty of other examples.
评论 #8558539 未加载
JCJoverTCPover 10 years ago
if length of the string is 1, this may shorten some answers, no?
评论 #8559918 未加载
评论 #8564159 未加载