Skip to content

Instantly share code, notes, and snippets.

@yigger
Created March 7, 2017 05:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yigger/6d07232ac5de457234b2f991e6e94cf2 to your computer and use it in GitHub Desktop.
Save yigger/6d07232ac5de457234b2f991e6e94cf2 to your computer and use it in GitHub Desktop.
char findTheDifference(char* s, char* t) {
int s_sum = 0;
int t_sum = 0;
while(*s != '\0') {
s_sum += *s;
s++;
}
while(*t != '\0') {
t_sum += *t;
t++;
}
return (char)abs(t_sum - s_sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment