EMC Interview Question for Software Engineer in Tests


Team: RSA
Country: India
Interview Type: Written Test




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

Reverse(String str)
{
if(str.length()==1)
return str;
return Reverse(str.substring(1,str.length()))+str.substring(0,1);
}

- Rishi June 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static String reverseStringWithRecursion(String initStr){
		char[] out=new char[initStr.length()];
		reverse(initStr.toCharArray(), out,0,out.length-1);
		return new String(out);
	}
	
	private static void reverse(char[] array,char[] out,int startIndex,int outIndex){
		if(startIndex==array.length) return;
		reverse(array, out, startIndex+1, outIndex-1);
		out[outIndex]=array[startIndex];
	}

- Avii June 03, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class StringReverseRecursion {

	public static void main(String[] args) {

		System.out.println(reverseString("ORACLE"));
	}


	public static String reverseString(String s){

		char [] out=new char[s.length()];
		reverse(s, out, 0, s.length()-1);	
		return new String(out);
	}

	public static void reverse(String input, char[] out, int startIndex, int outIndex){

		if(startIndex==input.length())
			return;
		reverse(input, out, startIndex+1, outIndex-1);
		out[outIndex]=input.charAt(startIndex);

	}


}

- deepakvijayan333 June 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void rec_rerverse(char []ch, int start,int end){

if (start<end){
char tmp=ch[start];
ch[start]=ch[end];
ch[end]=tmp;
rec_rerverse(ch,start++,--end);
}

}

- Anonymous June 07, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{{
#include "stdio.h"
#include "string.h"

int reverse(char * name, int len, int cur) {
printf("%s\n", name);
if(cur > len/2) return 0;
char c;
c = name[len-cur];
name[len-cur] = name[cur];
name[cur] = c;
printf("%s\n", name);
reverse(name, len, cur+1);
}

int main(int argc, char const *argv[])
{
char name[100];
char *n = "samana srikanth";
strncpy(name, n, strlen(n));
name[strlen(n)+1] = '\0';

reverse(name, strlen(name) - 1, 0);
return 0;
}

}}

- ssrikanth August 04, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include "stdio.h"
#include "string.h"

int reverse(char * name, int len, int cur) {
printf("%s\n", name);
if(cur > len/2) return 0;
char c;
c = name[len-cur];
name[len-cur] = name[cur];
name[cur] = c;
printf("%s\n", name);
reverse(name, len, cur+1);
}

int main(int argc, char const *argv[])
{
char name[100];
char *n = "samana srikanth";
strncpy(name, n, strlen(n));
name[strlen(n)+1] = '\0';

reverse(name, strlen(name) - 1, 0);
return 0;
}

- Anonymous August 04, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public static void main(String [] ar){
reverse("ORACLE", "");
}

public static void reverse(String str, String revStr){
if(str.length()!=revStr.length()){
revStr += str.charAt((str.length()-1)-revStr.length());
reverse(str, revStr);
}else{
System.out.println(revStr);
}

}

- Anonymous July 29, 2014 | 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