Skip to content

Practice Find the Difference

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#389
LeetCode Problem

Find the Difference

Problem Statement

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.

Source: Find the Difference on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "abcd", t = "abcde"
Output
"e"

# 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.

Related LeetCode Problems

Practice more problems similar to Find the Difference.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.