摘要:
1. 两数之和 Solution 思路1:直接双重for循环,枚举每个数字,找到后返回结果 class Solution { public int[] twoSum(int[] nums, int target) { int len = nums.length; for (int i = 0; i 阅读全文
摘要:
540. 有序数组中的单一元素 Solution 思路:异或遍历一遍,相同数字异或为0,异或结果即为单个数字的值。时间复杂度O(n) class Solution { public int singleNonDuplicate(int[] nums) { int m = nums.length; i 阅读全文