Facebook Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

for i in range (1, len(str)):
    leftstring = str[:i]
    rightstring = str[i:]
    if isWord(leftstring) and isWord(rightString):
        print leftstring + " " + rightstring + "\n"

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

/* Write a funtion that finds all the different ways you can split up a word
into a concatenation of two other words. */

#include <stdio.h>
#include <string.h>
void getleftstring(char *str,int index, char *leftstring);
void getrightstring(char *str,int index, char *rightstring);
int main()
{
char str[64];
int index = 0;
int len = 0;
char leftstring[64], rightstring[64];
printf("Enter the word:");
scanf("%s",str);
len = strlen(str);
for(index = 0; index < len-1; ++ index)
{
memset(leftstring,0, 64);
memset(rightstring,0, 64);
getleftstring(str,index,leftstring);
getrightstring(str,index,rightstring);
printf("%s : %s\n", leftstring, rightstring);
}
return 0;
}

void getleftstring(char *str,int index, char *leftstring)
{
char tempStr[64];
int i = 0;
memset(tempStr,0,64);
for(i = 0; i <= index; ++i)
tempStr[i] = str[i];
tempStr[i] = '\0';
strcpy(leftstring,tempStr);
}
void getrightstring(char *str,int index, char *rightstring)
{
char tempStr[64];
int i = 0;
int len = strlen(str);
memset(tempStr,0,64);
for(index = index+1; index < len; ++index)
tempStr[i++] = str[index];
tempStr[i] = '\0';
strcpy(rightstring,tempStr);
}

- Anonymous September 12, 2012 | 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