Programming Exercises

Build a component that finds the common elements between two hardcoded arrays and displays them.

Hard

Problem Statement

Build a component that finds the common elements between two hardcoded arrays and displays them.

Sample Input

Arrays: [1, 2, 3, 4], [3, 4, 5, 6]

Sample Output

Common Elements: [3, 4]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React from "react"; const CommonElements = () => { return ( <div> {/* Display common elements */} </div> ); }; export default CommonElements;
Log in or sign up to run or submit your code.Log inSign up
Input
Arrays: [1, 2, 3, 4], [3, 4, 5, 6]
Expected Output
Common Elements: [3, 4]