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

前端 未结 26 2053
余生分开走
余生分开走 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:00

    Even though it might break the rules. Here's a nice and short c++ entry:

    13 Characters

    l1.merge(l2); // Removes the elements from the argument list, inserts 
                  // them into the target list, and orders the new, combined 
                  // set of elements in ascending order or in some other 
                  // specified order.
    

提交回复
热议问题