Adobe Interview Question for Quality Assurance Engineers


Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
2
of 2 vote

public String reverse(String str){
	char[] array = str.toCharArray();
	int len = array.length -1;
	int mid = len/2;
 	for(int i = 0; i<=mid; i++)[
	  char temp = array[i];
  	  array [i] = array [len - i];
	   array [len -i] = temp;

return new String[array];
}

- Aresh April 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Here is an in-place solution:

public class ReverseString {

	public static String reverseMyString(String inputString)
	{
		if(inputString==null)
			return inputString;
		char[] inputArray=inputString.toCharArray();
		int start=0;
		int end=inputArray.length-1;
		while(start<end)
		{
			inputArray[start]=(char) (inputArray[start]^inputArray[end]);
			inputArray[end]=(char) (inputArray[start]^inputArray[end]);
			inputArray[start]=(char) (inputArray[start]^inputArray[end]);
			start++;
			end--;
		}
		return new String(inputArray);
	}
	
	public static void main(String[] args)
	{
		System.out.println(reverseMyString("vaibhav"));
	}
}

Efficiency suggestions are invited. :)

- teli.vaibhav April 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public String reverse(String s)
{
if (s.length() <= 1 || null==s)
{
return s;
}
return reverse(s.substring(1, s.length())) + s.charAt(0);
}

- Anonymus April 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public String reverse( String s )
{
    return ( new StringBuffer( s ) ).reverse().toString();
}

- Kandalintsev.Sergey April 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class reverseStr {


public static void main(String[] args) {
String str="lalabc";
String rev=new StringBuffer(str).reverse().toString();
System.out.println("reverse string is this "+rev);
}

}

- lal April 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class Reverse {

	public static void main(String args[]) throws IOException {
		String chr;
		InputStreamReader r = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(r);
		System.out.println("Enter your String: ");
		chr = br.readLine();
		String reverse = "";
		int len = chr.length();

		for (int i = len - 1; i > -1; i--) {
			reverse = reverse + chr.charAt(i);

		}
		System.out.println("Reversed String is:\t" + reverse);
	}}

- santosh kumar bhogapurapu August 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.text.ParseException;
import java.util.Scanner;

public class ReverseString {
    public static void main(String[] args) throws ParseException {
        Scanner input = new Scanner(System.in);
        String string = input.nextLine();
        ReverseString ob = new ReverseString();
        System.out.println("The reverse of " + string + " is :" + ob.reverseString(string));
    }

    public String reverseString(String str) {

        char[] ch = str.toCharArray();
        StringBuilder s = new StringBuilder();
        for (int i = ch.length - 1; i >= 0; i--) {
            s.append(ch[i]);
        }
        return s.toString();
    }

}

- Shilpi January 27, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.text.ParseException;
import java.util.Scanner;

public class ReverseString {
    public static void main(String[] args) throws ParseException {
        Scanner input = new Scanner(System.in);
        String string = input.nextLine();
        ReverseString ob = new ReverseString();
        System.out.println("The reverse of " + string + " is :" + ob.reverseString(string));
    }

    public String reverseString(String str) {

        char[] ch = str.toCharArray();
        StringBuilder s = new StringBuilder();
        for (int i = ch.length - 1; i >= 0; i--) {
            s.append(ch[i]);
        }
        return s.toString();
    }
}

- shilpigangwar333 January 27, 2019 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More