diff --git a/paginated_contents/algorithms/4th_thousand/README.md b/paginated_contents/algorithms/4th_thousand/README.md index d35da76ff4..60a60405de 100644 --- a/paginated_contents/algorithms/4th_thousand/README.md +++ b/paginated_contents/algorithms/4th_thousand/README.md @@ -5,6 +5,7 @@ | 3314 | [Construct the Minimum Bitwise Array I](https://leetcode.com/problems/construct-the-minimum-bitwise-array-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3314.java) | | Easy | | 3304 | [Find the K-th Character in String Game I](https://leetcode.com/problems/find-the-k-th-character-in-string-game-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3304.java) | | Easy | | 3300 | [Minimum Element After Replacement With Digit Sum](https://leetcode.com/problems/minimum-element-after-replacement-with-digit-sum/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3300java) | | Easy | +| 3289 | [The Two Sneaky Numbers of Digitville](https://leetcode.com/problems/the-two-sneaky-numbers-of-digitville/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3289.java) | | Easy | | 3285 | [Find Indices of Stable Mountains](https://leetcode.com/problems/find-indices-of-stable-mountains/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3285.java) | | Easy | | 3270 | [Find the Key of the Numbers](https://leetcode.com/problems/find-the-key-of-the-numbers/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3270.java) | | Easy | | 3264 | [Final Array State After K Multiplication Operations I](https://leetcode.com/problems/final-array-state-after-k-multiplication-operations-i/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/fourththousand/_3264.java) | | Easy | diff --git a/src/main/java/com/fishercoder/solutions/fourththousand/_3289.java b/src/main/java/com/fishercoder/solutions/fourththousand/_3289.java new file mode 100644 index 0000000000..68fb8dbaba --- /dev/null +++ b/src/main/java/com/fishercoder/solutions/fourththousand/_3289.java @@ -0,0 +1,20 @@ +package com.fishercoder.solutions.fourththousand; + +import java.util.HashSet; +import java.util.Set; + +public class _3289 { + public static class Solution1 { + public int[] getSneakyNumbers(int[] nums) { + int[] ans = new int[2]; + Set set = new HashSet<>(); + int i = 0; + for (int num : nums) { + if (!set.add(num)) { + ans[i++] = num; + } + } + return ans; + } + } +}