for Example:
Suppose user has opted the array with it's element which is below. we must do three steps:
first step:
Find the smallest number which is in this example (3) then move the index of the smallest number three times to forward then remove both the number in current index and the index which is (10) and do this while you arrived to the end of the array
note: When you arrived to the end of the array move the index of array to the beginning of that . and if the begging of the array had been removed, in this case you must move the index of array just once to forward
| 13 | 10 | 19 | 18 | 22 | 45 | 17 | 28 |
note:number 22 and it's index have been removed .
| 13 | 10 | 19 | 18 | 45 | 17 | 28 |
Continue the first Step but in this step we must not find the smallest number of array
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 28 and it's index have been removed .
| 13 | 10 | 19 | 18 | 45 | 17 |
Third step:
Continue the second step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 19 and it's index have been removed .
| 13 | 10 | 18 | 45 | 17 |
forth step:
Continue the third step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
Continue the third step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 17 and it's index have been removed .
| 13 | 10 | 18 | 45 |
fifth step:
Continue the forth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
Continue the forth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 18 and it's index have been removed .
| 13 | 10 | 45 |
sixth step:
Continue the fifth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
Continue the fifth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 10 and it's index have been removed .
| 13 | 45 |
seventh step:
Continue the fifth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
Continue the fifth step
note 1: When you arrive to the place of array that had been removed please underestimate to count this in the index movement.
note 2: number 45 and it's index have been removed .
| 13 |
the number which has been not removed is 13.
so, print it.

Replies
Know the answer? Post it — somebody with the same question will find it here.