JAVA solution


  • 0
    3
            public char findTheDifference(String s, String t) {
    		return (char) (getStrSum(t)-getStrSum(s));
    	}
    	
    	private int getStrSum(String s){
    		int sum = 0;
    		for (int i = 0; i < s.length(); i++) {
    			sum += s.charAt(i);
    		}
    		return sum;
    	}
    

Log in to reply
 

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