Intersection of Two Sorted Arrays

Given two non-empty integer arrays first and second, each sorted in non-decreasing order, return the unique values that appear in both arrays in increasing…

Given two non-empty integer arrays `first` and `second`, each sorted in non-decreasing order, return the unique values that appear in both arrays in increasing order.

- `1 <= first.length, second.length <= 10^5` - `-10^9 <= first[i], second[i] <= 10^9` - Both arrays are sorted in non-decreasing order. - The interactive visualizer accepts at most 10 values per array; longer valid inputs are execution-only.

Example 1: input first = [1,2,2,3,5], second = [2,2,3,4,5]; output [2,3,5]. Each common value appears once, even when it has repeated copies.

Example 2: input first = [1,2], second = [3,4]; output []. No value occurs in both arrays.

Category: Two Pointers. Topic: two-pointers. Difficulty: Easy. Patterns: two-pointers, sorting.