Skip to content

Commit

Permalink
[LEET-3289] add 3289
Browse files Browse the repository at this point in the history
  • Loading branch information
fishercoder1534 committed Oct 28, 2024
1 parent 090c5ba commit d75c98e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions paginated_contents/algorithms/4th_thousand/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/fishercoder/solutions/fourththousand/_3289.java
Original file line number Diff line number Diff line change
@@ -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<Integer> set = new HashSet<>();
int i = 0;
for (int num : nums) {
if (!set.add(num)) {
ans[i++] = num;
}
}
return ans;
}
}
}

0 comments on commit d75c98e

Please sign in to comment.