Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a program to find the intersection of two arrays.

Medium

Problem Statement

Create a program to find the intersection of two arrays.

Sample Input

Two arrays: [1, 2, 3, 4] and [3, 4, 5, 6]

Sample Output

Intersection: [3, 4]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
fun findIntersection(arr1: Array<Int>, arr2: Array<Int>): List<Int> { // Add your code here to find the intersection } fun main() { val arr1 = arrayOf(1, 2, 3, 4) val arr2 = arrayOf(3, 4, 5, 6) println("Intersection: ${findIntersection(arr1, arr2)}") }
Log in or sign up to run or submit your code.Log inSign up
Input
Two arrays: [1, 2, 3, 4] and [3, 4, 5, 6]
Expected Output
Intersection: [3, 4]