Find all common elements in 3 sorted arrays.

Assumptions

  • The 3 given sorted arrays are not null
  • There could be duplicate elements in each of the arrays

Examples

  • A = {1, 2, 2, 3}, B = {2, 2, 3, 5}, C = {2, 2, 4}, the common elements are [2, 2]

Solution: 3指针,3个相同时加入ans,否则右移最小的

results matching ""

    No results matching ""