2024/9/15 LeetCode 415周周赛
This commit is contained in:
parent
396723a171
commit
5b21fc35af
|
@ -1,4 +1,4 @@
|
|||
package com.cool.week414;
|
||||
package com.cool.week_match.week414;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
|
@ -0,0 +1,26 @@
|
|||
package com.cool.week_match.week415;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @Author: Cool
|
||||
* @Date: 2024/09/15/21:43
|
||||
* @Description:
|
||||
*/
|
||||
public class Q1 {
|
||||
|
||||
public int[] getSneakyNumbers(int[] nums) {
|
||||
int[] res=new int[2];
|
||||
int[] arr=new int[nums.length-2];
|
||||
int index=0;
|
||||
for(int num:nums){
|
||||
arr[num]++;
|
||||
}
|
||||
for(int i=0;i<arr.length;i++){
|
||||
if(arr[i]==2){
|
||||
res[index++]=i;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue