Skip to content
CampusEduX

Common Elements in Three Arrays

Easyjavapythonccppjavascript

Given three sorted arrays, find the values that occur in all three.

Input Format

The input contains three arrays, each given as its length on one line followed by that many space-separated integers on the next line: N, array A, M, array B, P, array C. Each array is sorted in non-decreasing order.

Output Format

Print the distinct common values in increasing order, separated by single spaces. If there are none, print an empty line.

Related Problems

  • Frequency Map
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find Duplicate Values
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Pair with Given Difference
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...