| 1 | class Solution |
| 2 | { |
| 3 | public int findDuplicate(int[] nums) |
| 4 | { |
| 5 | int index=0; |
| 6 | for(int i=0;i<nums.length;i++) |
| 7 | { |
| 8 | index=Math.abs(nums[i])-1; |
| 9 | if(nums[index]<0) |
| 10 | { |
| 11 | return Math.abs(nums[i]); |
| 12 | } |
| 13 | nums[index]=-nums[index]; |
| 14 | } |
| 15 | return -1; |
| 16 | } |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected