Amazon Interview Question for Software Engineer / Developers






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

we can do it in single scan.just scan each and every letter of the string and push it in the stack.Now pop the elements from the stack

- praneeth June 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Func Def
void iter_RevString( cha* str, int len)
{
for(int i=0; i<len/2; i++)
{
str[i] ^= str[len-1-i];
str[len-1-i] ^= str[i];
str[i] ^= str[len-1-i];
}
}

Func call -
iter_RevString(string, strlen(string));

- S ... November 06, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void StrRev(char *str)
{
char temp;

for (int i = 0; i < strlen(str)/2; i++) {
temp = str[len-1-i];
str[i] = str[len-1-i];
str[len-1-i] = temp;
}
}

- Smit November 28, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

def strreverse():
  mystr = ['c', 'o', 'd', 'i', 'n', 'g', ' ', 'i', 's', ' ', 'f', 'u', 'n']

  for i in range(0, len(mystr)):
    j = (len(mystr)-i) - 1
    if i == j or i > j:
      break
    e = mystr[j]
    mystr[j] = mystr[i] 
    mystr[i] = e

  print mystr

- binary bill February 20, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

func(char * arr, int size){
int i = 0;j=size-1;
while(j>i){
swap(a[i++],a[j--]);
}
}

- Anonymous February 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

unc(char * arr, int size){
int i = 0;j=size-1;
while(j>i){
swap(a[i++],a[j--]);
}
}

- Saurabh Shah February 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use recursive if allowed to use.. it will reduce the speed but has its own disadvantages

- xclrs March 26, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This technique might be optimal for your question:

void strrev(char *str)
{
    if(str[0] == NULL)
        return;
    else
    {
		strrev(str+1);
        printf("%c",str[0]);
        return;
	}
}

- multimayank January 30, 2013 | 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