My Simple Elegant Intuitive Solution

  • 1
    public class Solution {
        public char findTheDifference(String s, String t) {
            int [] schars = new int[26];
            for(int i=0; i<s.length(); i++)
            for(int j=0; j<t.length(); j++)
                if(--schars[t.charAt(j)-'a'] <0)
                    return t.charAt(j);
            return 0;

Log in to reply

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