PIXELBANKv9.1.0
Menu

Merge two sorted lists into one sorted list. Output as space-separated values.

Example:

Input:
1,2,4
1,3,4
Output:
1 1 2 3 4 4
Reasoning:
  • The problem starts with two sorted lists: [1, 2, 4] and [1, 3, 4].
  • The lists are merged by comparing elements from each list and adding the smaller one to the result list, resulting in a single sorted list: [1, 1, 2, 3, 4, 4].
  • The merged list is then output as space-separated values, giving the final output: 1 1 2 3 4 4.
  • No further calculations are needed, as the problem only requires a simple merge and sort operation.

Constraints:

  • 0 <= number of nodes <= 50
  • -100 <= Node.val <= 100
🔒

Editor locked

The code editor is locked for Pro problems. It is only available for free problems. Please upgrade to gain access to the code editor for all problems.

solution.py

Test Results

0/0
Run code to see test results.