Class Solution
java.lang.Object
g0301_0400.s0389_find_the_difference.Solution
389 - Find the Difference.<p>Easy</p>
<p>You are given two strings <code>s</code> and <code>t</code>.</p>
<p>String <code>t</code> is generated by random shuffling string <code>s</code> and then add one more letter at a random position.</p>
<p>Return the letter that was added to <code>t</code>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “abcd”, t = “abcde”</p>
<p><strong>Output:</strong> “e”</p>
<p><strong>Explanation:</strong> ‘e’ is the letter that was added.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = "", t = “y”</p>
<p><strong>Output:</strong> “y”</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “a”, t = “aa”</p>
<p><strong>Output:</strong> “a”</p>
<p><strong>Example 4:</strong></p>
<p><strong>Input:</strong> s = “ae”, t = “aea”</p>
<p><strong>Output:</strong> “a”</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 <= s.length <= 1000</code></li>
<li><code>t.length == s.length + 1</code></li>
<li><code>s</code> and <code>t</code> consist of lower-case English letters.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findTheDifference
-