about | help | code help+videos | done | prefs |
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number. Given an array list nums representing the data status of this set after the error. Your task is to firstly find the number occurs twice and then find the number that is missing. Return them in the form of an array. setMismatch([1, 2, 2, 4]) → [2, 3] setMismatch([3, 5, 7, 2, 7, 1, 6, 4, 8, 10]) → [7, 9] setMismatch([3, 2, 6, 3, 5, 4]) → [3, 1] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200
Copyright Nick Parlante 2017 - privacy