Posted on January 27, 2021January 27, 2021 Description Submission class Solution { int a[30005]; public: int findDuplicate(vector<int>& nums) { int n = nums.size(); for(int i = 0; i < n; ++i) { a[nums[i]]++; if(a[nums[i]] > 1) return nums[i]; } return 1; } }; By Bill0412 LeetCode Medium