Easy

Quiz

#389 Find the Difference

APPROACH

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"
1 of 4
1:00

What is the optimal approach for this problem?