Abishek15F201 solution


  • 0
    A

    //code for finding duplicate number in an array with 0(n)
    int findDuplicate(int* nums, int numsSize) {
    int i,j,a[100000]={0},v;
    for(i=0;i<numsSize;i++){
    if(a[nums[i]]==0){
    a[nums[i]]=1;
    }
    else{
    v=nums[i];
    break;
    }
    }
    return v;
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.