
Asked in Grey Orange
Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input:
The first line of input contains a single integer 'T', representing the number of test cases.
Each test case consists of one line containing the string 'STR'.
Output:
For each test case, output the reversed string of 'STR'. Each result must be printed on a new line.
Example:
Input:
2
hello
world!
Output:
olleh
!dlrow
Constraints:
1 ≤ T ≤ 10
1 ≤ |STR| ≤ 10^5
, where |STR| is the length of the string STR.- Time limit: 1 second.
Note:
Just implement the function; you do not need to print anything.

AnswerBot
1y
The task is to reverse a given string containing lowercase letters, uppercase letters, digits, and special characters.
Iterate through the string from the last character to the first character and appe...read more
Help your peers!
Add answer anonymously...
Interview Questions Asked to Software Engineer at Other Companies
Top Skill-Based Questions for Grey Orange Software Engineer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

