算法 - leetcode:Merge Two Sorted Lists;链表是从升序还是倒序排序?

查看:108
本文介绍了算法 - leetcode:Merge Two Sorted Lists;链表是从升序还是倒序排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

  1. Merge Two Sorted Lists

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

https://leetcode.com/problems...

我看这道题有一个测试用例,输入([2],[1])输出(1,2)
说明是升序,但是题目只是说列表是sorted的,没说明一定是升序吧,还是我有什么地方看漏了?

解决方案

一般默认升序。

这篇关于算法 - leetcode:Merge Two Sorted Lists;链表是从升序还是倒序排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆