Created
October 13, 2016 22:38
-
-
Save Roger7410/b7e5dd03c9669017c8382bc6fe72826f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //It is a more effictive way than HASHTABLE | |
| public class Solution { | |
| public char findTheDifference(String s, String t) { | |
| char[] ss = s.toCharArray(); | |
| char[] tt = t.toCharArray(); | |
| char result = 0; | |
| for(int i = 0; i <ss.length; i++){ | |
| result ^= ss[i]; | |
| result ^= tt[i]; | |
| } | |
| result ^= tt[tt.length-1]; | |
| return result; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment