How to delete a specific element from an array if the condition is satisfied? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to delete a specific element from an array if the condition is satisfied?

I've to write program where I've to delete one of the elements from an array (integer type) if same element appears consecutively. How can I achieve so?

10th Sep 2022, 2:23 PM
ss7
1 Answer
+ 2
show us your attempt on this .. we will definitely help you correct it.. it depends on how you choose to store the array elements and what type of data structure youre using .. like for std::vector you could use erase() for c style array you need to do it old way ( copy the entire array in some other array )
10th Sep 2022, 2:26 PM
Prashanth Kumar
Prashanth Kumar - avatar