Finding missing elements in an array

前端 未结 9 1314
我寻月下人不归
我寻月下人不归 2020-12-23 10:43

Given you have an array A[1..n] of size n, it contains elements from the set {1..n}. However, two of the elements are missing, (and perhaps two of the array elements are rep

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 11:29

    As you have given an array of n size and find the missing number when it's in a sequence.

    #include
    main()
    {
    print("value of n");
    scan("%d",&n);
    print("enter the elements");
    for(i=0;i

    It would find the missing when its in sequence only.

提交回复
热议问题