public class Solution { public int singleNumber(int[] nums) { int ret = nums[0]; for (int i = 1; i < nums.length; i++) { ret ^= nums[i]; } return ret; } }
时间: 2024-10-12 13:29:20
public class Solution { public int singleNumber(int[] nums) { int ret = nums[0]; for (int i = 1; i < nums.length; i++) { ret ^= nums[i]; } return ret; } }