lundi 19 mars 2018

Сhange array according to the algorithm

Good day, I can't think of a solution algorithm. Condition for changing the array

if i < i++ then copy it to a new array;

if i > i++ then i++ = i-i++;

then proceed to the next element;

Example:

at the entrance [1, 20, 1, 2, 3, 16, 18]

output [1, 14, 16, 18]

the source array took the form of a [1, 20, 19, 17, 14, 16, 18]

I would like to implement it through <algorithm> if possible.

Aucun commentaire:

Enregistrer un commentaire