leetcode386
Posted AsenYang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode386相关的知识,希望对你有一定的参考价值。
1 class Solution: 2 def lexicalOrder(self, n: int) -> List[int]: 3 lis = [str(i) for i in range(1,n+1)] 4 lis.sort() 5 return lis
算法思路:按字符串顺序排序。
当然有能力的同学可以尝试自己实现字符串排序的逻辑,我就不做这种高难度的挑战了。
以上是关于leetcode386的主要内容,如果未能解决你的问题,请参考以下文章