leetcode-5404-用栈操作数组
2021-01-24 10:16
标签:push style leetcode 技术 def div list pre array 题目描述: 提交:O(N) leetcode-5404-用栈操作数组 标签:push style leetcode 技术 def div list pre array 原文地址:https://www.cnblogs.com/oldby/p/12865398.htmlclass Solution:
def buildArray(self, target: List[int], n: int) -> List[str]:
res = []
a = "Push"
b = "Pop"
index = 1
for i in target:
while index != i:
res.append(a)
res.append(b)
index += 1
res.append(a)
index += 1
return res
上一篇:C++ 单定义规则
下一篇:Java基础之线程1
文章标题:leetcode-5404-用栈操作数组
文章链接:http://soscw.com/index.php/essay/46283.html