3289. The Two Sneaky Numbers of Digitville Easy

@problem@discussion
#Array#Hash Table#Math



1/**
2 * [3289] The Two Sneaky Numbers of Digitville
3 *
4 * In the town of Digitville, there was a list of numbers called nums containing integers from 0 to n - 1. Each number was supposed to appear exactly once in the list, however, two mischievous numbers sneaked in an additional time, making the list longer than usual.<!-- notionvc: c37cfb04-95eb-4273-85d5-3c52d0525b95 -->
5 * As the town detective, your task is to find these two sneaky numbers. Return an array of size two containing the two numbers (in any order), so peace can return to Digitville.<!-- notionvc: 345db5be-c788-4828-9836-eefed31c982f -->
6 *  
7 * <strong class="example">Example 1:
8 * <div class="example-block">
9 * Input: <span class="example-io">nums = [0,1,1,0]</span>
10 * Output: <span class="example-io">[0,1]</span>
11 * Explanation:
12 * The numbers 0 and 1 each appear twice in the array.
13 * </div>
14 * <strong class="example">Example 2:
15 * <div class="example-block">
16 * Input: <span class="example-io">nums = [0,3,2,1,3,2]</span>
17 * Output: <span class="example-io">[2,3]</span>
18 * Explanation: 
19 * The numbers 2 and 3 each appear twice in the array.
20 * </div>
21 * <strong class="example">Example 3:
22 * <div class="example-block">
23 * Input: <span class="example-io">nums = [7,1,5,4,3,4,6,0,9,5,8,2]</span>
24 * Output: <span class="example-io">[4,5]</span>
25 * Explanation: 
26 * The numbers 4 and 5 each appear twice in the array.
27 * </div>
28 *  
29 * Constraints:
30 * 
31 * 	<li data-stringify-border="0" data-stringify-indent="1">2 <= n <= 100
32 * 	<li data-stringify-border="0" data-stringify-indent="1">nums.length == n + 2
33 * 	<li data-stringify-border="0" data-stringify-indent="1"><code data-stringify-type="code">0 <= nums[i] < n
34 * 	<li data-stringify-border="0" data-stringify-indent="1">The input is generated such that nums contains exactly two repeated elements.
35 * 
36 */
37pub struct Solution {}
38
39// problem: https://leetcode.com/problems/the-two-sneaky-numbers-of-digitville/
40// discuss: https://leetcode.com/problems/the-two-sneaky-numbers-of-digitville/discuss/?currentPage=1&orderBy=most_votes&query=
41
42// submission codes start here
43
44impl Solution {
45    pub fn get_sneaky_numbers(nums: Vec<i32>) -> Vec<i32> {
46        vec![]
47    }
48}
49
50// submission codes end
51
52#[cfg(test)]
53mod tests {
54    use super::*;
55
56    #[test]
57    fn test_3289() {
58    }
59}
60


Back
© 2025 bowen.ge All Rights Reserved.