diff --git a/src/main/java/com/cool/hot100/strange_skills_cunning/Num136.java b/src/main/java/com/cool/hot100/strange_skills_cunning/Num136.java new file mode 100644 index 0000000..f9966b1 --- /dev/null +++ b/src/main/java/com/cool/hot100/strange_skills_cunning/Num136.java @@ -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; + } +}