Code golf: combining multiple sorted lists into a single sorted list

前端 未结 26 2018
余生分开走
余生分开走 2020-12-29 12:42

Implement an algorithm to merge an arbitrary number of sorted lists into one sorted list. The aim is to create the smallest working programme, in whatever language you like.

26条回答
  •  情书的邮戳
    2020-12-29 13:11

    OCaml in 42 characters:

    let f=List.fold_left(List.merge compare)[]
    

    I think I should get extra credit for 42 exactly?

提交回复
热议问题