Union of Two Sorted Arrays

Given two non-empty integer arrays a and b, each sorted in non-decreasing order, return their union in increasing order. Every distinct value that occurs in…

Given two non-empty integer arrays `a` and `b`, each sorted in non-decreasing order, return their union in increasing order. Every distinct value that occurs in either array must appear exactly once in the result.

- `1 <= a.length, b.length <= 10^5` - `-10^9 <= a[i], b[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 a = [1,2,3,4,5], b = [2,3,4,4,5,6]; output [1,2,3,4,5,6]. Values appearing in both arrays are included only once.

Example 2: input a = [1,1,2], b = [2,2,3]; output [1,2,3].

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