Menu
Coddy logo textTech

11. Common Elements

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

challenge icon

Challenge

Easy

Write a function to find the common elements between two arrays.

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

Try it yourself

#include <vector>
using namespace std;

vector<int> findCommonElements(vector<int> arr1, vector<int> arr2) {
    // Write code here
}

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