← 返回 meta 的题目列表Merge Two Sparse Sorted Lists Without Zeros
类型:online_judge
meta
Merge Two Sparse Sorted Lists
Given two lists of integers, list1 and list2, each containing a lot of zeros, but apart from the zeros, the elements are sorted. Merge these two lists into a single sorted list without zeros.
Input:
list1: A list of integers, e.g., [1, 0, 0, 0, 2, 0, 0, 0, 3, 0]
list2: Another list of integers.
Output:
A merged sorted list of integers without zeros.
Example:
Input: [1, 0, 0, 0, 2, 0, 0, 3], [0, 2, 0, 0, 4, 5] Output: [1, 2, 2, 3, 4, 5]
Example
Input
[1, 0, 0, 0, 2, 0, 0, 3], [0, 2, 0, 0, 4, 5]