2024/9/29 奇技淫巧
This commit is contained in:
parent
58b2b1e113
commit
d1c11740b1
|
@ -0,0 +1,23 @@
|
||||||
|
package com.cool.hot100.strange_skills_cunning;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @Author: Cool
|
||||||
|
* @Date: 2024/09/30/3:20
|
||||||
|
* @Description: 136. 只出现一次的数字
|
||||||
|
* Hard 1
|
||||||
|
* Level 3
|
||||||
|
* DayNumber 4
|
||||||
|
* @link https://leetcode.cn/problems/single-number/description/?envType=study-plan-v2&envId=top-100-liked
|
||||||
|
*/
|
||||||
|
public class Num136 {
|
||||||
|
//位运算
|
||||||
|
public int singleNumber(int[] nums) {
|
||||||
|
int res=0;
|
||||||
|
for(int num:nums){
|
||||||
|
res^=num;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue