Skip to content

Commit 1ac64e3

Browse files
committed
\^_^/
1 parent 71961c8 commit 1ac64e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

source-code/Find_the_Duplicate_Number.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class Solution {
99
public:
1010
int findDuplicate(vector<int>& nums) {
1111
if(nums.empty()) return 0;
12-
int left = 0, right = nums.size() - 1;
12+
int n = nums.size();
13+
int left = 1, right = n - 1;
1314
while(left < right) {
1415
int mid = left + (right - left) / 2;
1516
int cnt = countNumbers(nums, mid);

0 commit comments

Comments
 (0)