LeetCode 389, Easy. Topics: Hash Table, String, Bit Manipulation, Sorting. View on LeetCode.
Generate this problem as a practice environment: tested reference solution, 14 parametrized pytest cases, and a playground notebook:
Problem
You are given two strings s and t.
String t is generated by random shuffling string s and then add one more letter at a random position.
Return the letter that was added to t.
Examples
Constraints
0 <= s.length <= 1000
t.length == s.length + 1
s and t consist of lowercase English letters.
Solution
Reference implementation from solution.py on GitHub, full suite in test_solution.py:
Complexity
NeetCode All. Last modified on September 7, 2026