NetApp Interview Question for Software Engineer / Developers






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

Concatante the original string with itself and search for second string.
using strstr()

- ManishSindhi January 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice one!

- test January 26, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice one indeed.

- varun October 13, 2011 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

I like it, but you need to check that they are the same length first.
I give you "cans" and "scans"

- anon January 29, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

algo

mid=strlen(a)/2;
for(i=0;i<=n/2;i++)
temp=a[mid+i+1];
a[mid+i+1]=a[i];
a[i]=temp;

- bhavesh January 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

algo

mid=strlen(a)/2;
for(i=0;i<=n/2;i++)
temp=a[mid+i+1];
a[mid+i+1]=a[i];
a[i]=temp;

- bhavesh January 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Prove that at the end of the for loop, we would get back the original string?
Input= eabcd?

- Sriram January 17, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strstr() or its algorithm thereof
then use a match chars, wrapping around if end of string is reached

it's basically asking for a strstr algo

- Anonymous January 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

suppose the length is odd or even
then we can get it solved

- Anonymous January 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int compare(char *s,char *t)
{
char *ptr,ch=*s;
ptr=strchr(t,ch);
if(!strncmp(s,ptr,strlen(ptr)))
{
s=s+strlen(ptr);
if(!strncmp(t,s,strlen(s)))
return(1);
else
return(0);
}
else return(0);
}

- Anonymous January 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

first find the position POS firstCharOf s2 in s1 in O(n)
then
.................
count=0;
if(len1!=len2) return false;
while(count!=len2)
{
if(s1[POS]!=s2[count])return false;

count++;POS++;
if(s1[POS]=='\0') POS=0;
}
return true;

- mohit January 21, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Double S2 to S2S2 like "cdabcdab", use KMP to search if S1 "abcd" in S2S2.

Come back to check again whether there is a false match like S2="cdaaaaaaaab";

- Zhen January 22, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main()
{
char *len1,len2,rot=0;
char str1[]="ceaser";
char str2[] = "erceas";

char str3[20];

strcpy(str3,str1);

strcat(str3,str1);
len1 = strstr(str3,str2);

if(len1 == NULL)
printf("false");
else
printf("true");
}

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

Using python

str1 = 'abcd'
str2 = 'bcda'
l1 = list(str1)
l2 = list(str2)
is_found = False
for each in range(1, len(str1)):
l1 = [l1.pop()] + l1[:len(str1)-1]
if "".join(l1) == str2:
is_found = True
break
if is_found == True:
print ("{} and {} are same strings that can be rotated".format(str1, str2))
else:
print("not found")

- Nazir March 22, 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