Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. class Solution {
  2. public:
  3. char findTheDifference(string s, string t) {
  4. char ta[123] = { 0 };
  5. for (char c: t) {
  6. ta[c]++;
  7. }
  8. for (char c: s) {
  9. ta[c]--;
  10. }
  11. for (char i = 97; i < 123; i++) {
  12. if (ta[i] > 0) {
  13. return i;
  14. }
  15. }
  16. return 'a';
  17. }
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement