950. Reveal Cards In Increasing Order
题目要求:https://blog.csdn.net/qq_17550379/article/details/84894718
Discuss里面的高票答案:
class Solution:
def deckRevealedIncreasing(self, deck):
"""
:type deck: List[int]
:rtype: List[int]
"""
b = sorted(deck)
res = []
for i in b[::-1]:
res = [i] + res[-1:] +res[:-1]
return res
总结:做题不能用蛮力,还是要先找规律,找到算法了再动手做。对list的用法不是很熟悉。