## NetApp Interview Question for Software Engineer / Developers

• 0

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()

Comment hidden because of low score. Click to expand.
0

nice one!

Comment hidden because of low score. Click to expand.
0

nice one indeed.

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"

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;

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;

Comment hidden because of low score. Click to expand.
0

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

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

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

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);
}

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;

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";

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");
}

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:

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.

### 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.