Find the Difference

IF
AlgoAxiomStaff Engineers
JSTS
Easy20 mins

You are given two strings s and t.

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

Return the letter that was added to t.

Examples

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"

Constraints

  • 0 <= s.length <= 1000
  • t.length == s.length + 1
  • s and t consist of lowercase English letters.
Source: Bitwise Manipulation pattern — AlgoAxiom
JavaScript
Test Case 1
root = [1, 2, 3]
Test Case 2
root = [1, 2, 3, 4, 5]
Idle