Finding the intersection of two arrays and storing that intersection in a temporary array before searching for the intersection of the third array and temporary array is a straightforward approach.
This solution's time complexity is O(n1 + n2 + n3), where n1, n2 and n3 are the corresponding sizes of ar1[], ar2[] and ar3[].
The common elements can be found using a single loop and without the need for extra space, unlike the above solution that uses extra space and two loops. The concept is comparable to how two arrays intersect. We traverse three arrays in a loop similar to two arrays looping. Let x, y, and z represent the current elements being traversed in ar1, ar2, and ar3, respectively. The following scenarios are possible inside the loop.
Learn more about array here-
https://brainly.com/question/19570024
#SPJ4