Find one difference - java simple solution using string manipulation


  • 0
    Y
    class Solution {
        public char findTheDifference(String s, String t) {
           for(char c : s.toCharArray())
           {
               t = t.replaceFirst(c+"","");
           }
            return t.charAt(0);
        }
    }
    

Log in to reply
 

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