Find the Difference

Published by Deep Xavier in

You are given two strings s and t.

String t is generated by randomly shuffling string s and then adding one more letter at a random position.

Return the letter that was added to t.

Examples

findTheDifference("", "t") ➞ "t"

findTheDifference("abcd", "abcde") ➞ "e"

findTheDifference("rt", "rst") ➞ "s"

findTheDifference("gjklmn", "ghjklmn"") ➞ "h"

findTheDifference("ae", "aea") ➞ "a"

Notes

N/A

Watch a quick demo on how Edabit works.