Skip to content

Commit 9d0f892

Browse files
authored
Update ImplementQueueUsingStacks.swift
Add question link and complexity analysis
1 parent 2566a6e commit 9d0f892

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Queue/ImplementQueueUsingStacks.swift

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Question Link: https://leetcode.com/problems/implement-queue-using-stacks/
3+
* Primary idea: queue
4+
* Time Complexity: O(n), Space Complexity: O(n)
5+
*
6+
* Copyright © 2019 Ilyar Mnazhdin. All rights reserved.
7+
8+
* Your MyQueue object will be instantiated and called as such:
9+
* let obj = MyQueue()
10+
* obj.push(x)
11+
* let ret_2: Int = obj.pop()
12+
* let ret_3: Int = obj.peek()
13+
* let ret_4: Bool = obj.empty()
14+
*/
15+
116
import Foundation
217

318
class MyQueue {
@@ -29,12 +44,3 @@ class MyQueue {
2944
return storage.isEmpty
3045
}
3146
}
32-
33-
/**
34-
* Your MyQueue object will be instantiated and called as such:
35-
* let obj = MyQueue()
36-
* obj.push(x)
37-
* let ret_2: Int = obj.pop()
38-
* let ret_3: Int = obj.peek()
39-
* let ret_4: Bool = obj.empty()
40-
*/

0 commit comments

Comments
 (0)