首页 > 代码库 > find-the-difference

find-the-difference

https://leetcode.com/problems/find-the-difference/public class Solution {    public char findTheDifference(String s, String t) {        char[] sch = s.toCharArray();        char[] tch = t.toCharArray();        Arrays.sort(sch);        Arrays.sort(tch);        for (int i=0; i<sch.length; i++) {            if (sch[i] != tch[i]) {                return tch[i];            }        }        return tch[tch.length-1];    }}

 

find-the-difference