Find the Difference
def findTheDifference(s: String, t: String):Char = {
var acc = t(t.length-1)
for (i <- 0 until s.length) {
acc ^= s(i) ^ t(i)
}
acc
}
findTheDifference("abcd", "abcde")Last updated
def findTheDifference(s: String, t: String):Char = {
var acc = t(t.length-1)
for (i <- 0 until s.length) {
acc ^= s(i) ^ t(i)
}
acc
}
findTheDifference("abcd", "abcde")Last updated