26. Merge two sorted lists

EasyProgramFree10 points

xs and ys are sorted in increasing order. Write merge xs ys, a sorted list containing every element of both, with repeated values kept.

Examples

  1. Inputmerge [1, 2, 4] [1, 3, 4]Output[1, 1, 2, 3, 4, 4]
  2. Inputmerge [] [0]Output[0]

Submitting also runs 6 hidden tests.

Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser