Menu
Coddy logo textTech

16. Remove Element from Array

Lesson 17 of 31 in Coddy's 30 Days of Logic Building in C++ course.

challenge icon

Challenge

Easy

Write a function to remove a specific element from an array.

  • Input: [1, 2, 3, 4, 5], 3
  • Output: [1, 2, 4, 5]

Try it yourself

#include <vector>
using namespace std;

vector<int> removeElement(vector<int> arr, int element) {
    // Write code here
}

All lessons in 30 Days of Logic Building in C++