
Asked in UST and 10 others
How do you reverse a string without using a predefined method?

AnswerBot
1y
Logic to reverse a string without using string functions
Iterate through the string from the last character to the first
Create a new string and append each character to it in reverse order
jone selas
1y
string originalString = "test"; string reverseString = string.Empty; foreach (char c in originalString) { reverseString = c + reverseString; } return reverseString;
Mukesh Ningadali
3y
import java.util.Scanner;
public class ReverseStringByScanner {
public static void main(String[] args) {
String str;
Scanner scanner=new Scanner(System.in);
System.out.print("Enter a Str...read more
Anonymous
3y
class ReverseString
{
public static void main(String[] args)
{
String str = "Hello team";
String reverseString = "";
for(int i = str.length() - 1 ; i>=0 ; i--)
{
reverseString += str.charAt(i);...read more
Sonu Dixit
5y
Sir nokri dedo
Add answer anonymously...
Interview Questions from Popular Companies

3.7
• 8.7k Interviews

4.0
• 5.4k Interviews

3.5
• 4.2k Interviews

3.6
• 8k Interviews

3.7
• 5.9k Interviews

3.7
• 6.1k Interviews

3.5
• 4.2k Interviews

3.7
• 5.1k Interviews
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

