题解 | #只出现一次的数字#
只出现一次的数字
https://www.nowcoder.com/practice/c04bd25f0396471b90dfc30d96b9109b
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型一维数组 * @param numsLen int nums数组长度 * @return int整型 */ int singleNumber(int* nums, int numsLen ) { // write code here int result= 0; for(int i = 0;i<numsLen;i++) { result^=nums[i]; } return result; }