← Discussions on Reverse String
G gurpreet_42
25 Jul 2026, 17:56

Asked in my Juspay OA last week.

Work with character counts or indices rather than building new strings in the loop; string concatenation inside loops is what usually causes TLE here.

2 replies

vamsisax3 2 months, 3 weeks ago

Great explanation, the edge case with an empty input tripped me up too.

aditimenon 2 months, 2 weeks ago

You can avoid the extra array and do it in O(1) space.

Sign in to reply.