//给定两个字符串 s 和 t,它们只包含小写字母。

  //字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母。

  //请找出在 t 中被添加的字母

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

char
findTheDifference(char* s, char* t) { int len_s = strlen(s); int len_t = strlen(t); if(len_s==0) return *t; char r = t[len_s]; int i =0; for(;i<len_s;i++){ r ^= s[i]^t[i]; } return r; }

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄