Find Common Elements in Three Sorted Arrays – Java Code

Write a java program to find common elements in three sorted arrays.

Given three sorted arrays, write a code to print intersection of three sorted arrays.

For example –

arr1 = {1, 5, 10, 20, 40, 80};
arr2 = {6, 7, 20, 80, 100};
arr3 = {3, 4, 15, 20, 30, 70, 80, 120};

Output : {20, 80}

20 and 80 are the common elements in 3 arrays. These two elements are the intersection of 3 sorted arrays.