leetcode.com/problems/set-mismatch/submissions/906585553/
1 Users
0 Comments
1 Highlights
1 Notes
Tags
Top Highlights
lass Solution { public int[] findErrorNums(int[] nums) { List<Integer> ans = new ArrayList<>(); for (int i = 0; i < nums.length - 1; i++) { if (nums[i] == nums[i + 1]) { ans.add(nums[i]); ans.add(nums[i + 1] + 1); } } return ans.stream().mapToInt(Integer::intValue).toArray(); }
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.