Package g0601_0700.s0645_set_mismatch
Class Solution
java.lang.Object
g0601_0700.s0645_set_mismatch.Solution
645 - Set Mismatch.<p>Easy</p>
<p>You have a set of integers <code>s</code>, which originally contains all the numbers from <code>1</code> to <code>n</code>. Unfortunately, due to some error, one of the numbers in <code>s</code> got duplicated to another number in the set, which results in <strong>repetition of one</strong> number and <strong>loss of another</strong> number.</p>
<p>You are given an integer array <code>nums</code> representing the data status of this set after the error.</p>
<p>Find the number that occurs twice and the number that is missing and return <em>them in the form of an array</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [1,2,2,4]</p>
<p><strong>Output:</strong> [2,3]</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [1,1]</p>
<p><strong>Output:</strong> [1,2]</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 <= nums.length <= 10<sup>4</sup></code></li>
<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
findErrorNums
public int[] findErrorNums(int[] nums)
-