easiest to understand, 9ms java solution


  • 1
    L

    public class Solution {
    public char findTheDifference(String s, String t) {
    char c = 0;
    String sum = s + t;
    for (int i = 0; i < sum.length(); i++) {
    c ^= sum.charAt(i);
    }
    return c;
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.