#389
Find the Difference
pupil · 380 · lc easy +24 · verified · 60.2% accepted · 5,453 likes · top 59%
Description
You are given two strings s and t. String t was created by randomly shuffling the characters of s and then inserting one extra character at an arbitrary position.
Identify and return the extra character that was added.
Example 1:
Input: s = "abcd", t = "abcde"
Output: "e"
Explanation: 'e' is the letter that was added.
Example 2:
Input: s = "", t = "y"
Output: "y"
Code
1
2
3