is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
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.
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.
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.
How about the following solution:
- sam.d.1990 January 22, 2015#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 1000
void reverse(char *str){
int i = 0;
int j = strlen(str) - 1;
char temp;
while (i < j) {
temp = str[i];
str[i] = str[j];
str[j] = temp;
i++;
j--;
}
}
char * getnext(char *first){
int len_first = strlen(first);
int j=0;
int i,carry=1,value,sum;
char *res = (char *)malloc((len_first+1)*sizeof(char));
for(i=len_first-1;i>=0;i--){
sum = (int)((first[i]-'0')+carry);
if(sum >= 10){
carry = 1;
value = sum%10;
}
else{
carry = 0;
value = sum;
}
res[j++] = (char)(((int)'0')+value);
}
if(carry)
res[j++] = (char)(((int)'0')+carry);
res[j] = '\0';
reverse(res);
return res;
}
int main(void) {
char inp[MAX];
gets(inp);
int len = strlen(inp);
int i,next_len,curr_start,curr_len;
char *next_str,*curr_str;
int missing_count;
char *missing;
for(i=1;i<len/2+1;i++){
curr_start = 0;
curr_len = i;
missing_count=0;
while(curr_start+curr_len<len){
curr_str = (char *)malloc((curr_len)*sizeof(char));
strncpy(curr_str,inp+curr_start,curr_len);
curr_str[curr_len]='\0';
next_str = getnext(curr_str);
next_len = strlen(next_str);
char *temp = (char *)malloc(next_len*sizeof(char));
strncpy(temp,inp+curr_start+curr_len,next_len);
temp[next_len]='\0';
//printf("1CURR: %s Next: %s Next Shd: %s\n",curr_str,temp,next_str);
if(strcmp(next_str,temp) == 0){
curr_start +=curr_len;
curr_len = next_len;
}
else{
//printf("Mismatch\n");
missing_count++;
if(missing_count>1){
free(missing);
break;
}
missing = (char *)malloc(strlen(temp)*sizeof(char));
strcpy(missing,next_str);
missing[strlen(temp)]='\0';
next_str = getnext(next_str);
//printf("2CURR: %s Next: %s Next Shd: %s\n",curr_str,temp,next_str);
if(strcmp(next_str,temp) == 0){
curr_start +=curr_len;
curr_len = next_len;
}
else{
missing_count++;
free(curr_str);
free(next_str);
break;
}
}
}
if(missing_count == 1)
break;
}
//printf("------------------------\n");
puts(missing);
return 0;
}