mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 13:06:47 +08:00
update
This commit is contained in:
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"27.5K\", \"totalSubmission\": \"38.5K\", \"totalAcceptedRaw\": 27486, \"totalSubmissionRaw\": 38459, \"acRate\": \"71.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"27.5K\", \"totalSubmission\": \"38.5K\", \"totalAcceptedRaw\": 27533, \"totalSubmissionRaw\": 38524, \"acRate\": \"71.5%\"}",
|
||||
"hints": [
|
||||
"队列和栈的主要区别是元素的顺序。队列删除最旧的项,栈删除最新的项。如果你只访问最新的项,那么如何从栈中删除最旧的项?",
|
||||
"我们可以通过不断地删除最新的项(将这些项插入临时栈中)来删除栈中最老的项,直到得到一个元素为止。然后,在检索到最新项后,将所有元素返回。与此有关的问题是,每次在一行中做几个弹出操作(pop)将需要O(n)的时间。我们可以优化在一行中连续弹出这一场景吗?"
|
||||
|
Reference in New Issue
Block a user