Microsoft Interview Question for Software Engineer / Developers






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

hash + two iterators

- adon September 24, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

void removePattern(char str[], char pattern[]){

char removeArray[256];//8bit ASCII characters

int i;
for(i=0;i<256;i++)
removeArray[i]= 0; //setting all to zero at first
for(i=0;i<strlen(pattern);i++)
removeArray[pattern[i]]= 1; //setting the ASCII values from pattern

int read=0,write=0;
char buffer[strlen(str)+1];
while(str[read]){
if(!removeArray[str[read]])
buffer[write++]=str[read++];
}
buffer[write]='\0';
strcpy(str,buffer);
}

- Raman November 22, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

RemovePattern(char* str, char* pattern)
{
if(!str||!pattern) return;
int hash[256]={0};
for(int i=0;i<strlen(pattern);i++)
hash[pattern[i]]=1;
char* p1=str;
char* p2=p1+1;
while(hash[*p1])
*p1=*p2++;
if(*p1=='\0') return;
while(*p2)
{
if(!hash[*p2])
*(++p1)=*p2++;
else p2++;
}
return;
}

- winia November 02, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use bitwise hashing :-

- piyush1989kapoor February 09, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strtok....
char str[] ="cdxddeeefce",pat[]="cex";;
char *pch;string s="",st;
pch = strtok (str,pat);
while (pch != NULL)
{
st.assign(pch);
s+=st;
pch = strtok (NULL,pat);
}
cout<<s;

- sg December 17, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strtok....
char str[] ="cdxddeeefce",pat[]="cex";;
char *pch;string s="",st;
pch = strtok (str,pat);
while (pch != NULL)
{
st.assign(pch);
s+=st;
pch = strtok (NULL,pat);
}
cout<<s;

- sg December 17, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strtok....
char str[] ="cdxddeeefce",pat[]="cex";;
char *pch;string s="",st;
pch = strtok (str,pat);
while (pch != NULL)
{
st.assign(pch);
s+=st;
pch = strtok (NULL,pat);
}
cout<<s;

- sg December 17, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strtok....
char str[] ="cdxddeeefce",pat[]="cex";;
char *pch;string s="",st;
pch = strtok (str,pat);
while (pch != NULL)
{
st.assign(pch);
s+=st;
pch = strtok (NULL,pat);
}
cout<<s;

- sg December 17, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use strtok....
char str[] ="cdxddeeefce",pat[]="cex";;
char *pch;string s="",st;
pch = strtok (str,pat);
while (pch != NULL)
{
st.assign(pch);
s+=st;
pch = strtok (NULL,pat);
}
cout<<s;

- sg December 17, 2009 | 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