LeetCode

<<<<<<< HEAD

Array部分

  1. Array Partition I



对于一组数,选择其中的一半求和,并且让结果最大。需要让相邻元素之间的距离最小,所以可以先排序,然后对于其中奇数项进行求和。
首先考虑冒泡排序,提交后发现TimeLimitExceeded,换用快速排序后AC。


快速排序的平均时间复杂度更低,缺点是不太稳定。

=======
This Repo record the solutions about LeetCode.
And the LeetCode.pdf is the note during thinking and writing code...

e0ca59d453ce45c1eb2ea52a24f070ca05c9b91d

猜你喜欢

转载自www.cnblogs.com/Hooooober/p/8975174.html