Intersection of Three Sorted Arrays
You can find the intersection of three sorted arrays by using pointers for each array and then compare the elements at the current pointers. Here’s the stepbystep guide:
 Initialize Pointers: Start with pointers for each array at the beginning (i.e.,
i = 0, j = 0, k = 0
).  Compare Values: Compare the values at the current pointers (i.e.,
arr1[i], arr2[j], arr3[k]
).  Advance Pointers: Based on the comparison, advance the pointers.
 Collect Common Elements: If the three values are the same, add them to the result list and advance all three pointers.
 Stop Condition: Continue until any of the pointers reaches the end of its corresponding array.
Here’s the code:


Explanation:
 We use three pointers
i, j, k
to traverse the three arrays.  We compare the elements at these pointers and decide which pointers to move forward.
 If all three elements are the same, we add them to the result and move all pointers forward.
This approach leverages the fact that the arrays are sorted, and hence the time complexity is O(N), where N is the maximum length among the three arrays.