Skip to content

Commit 28f1fc3

Browse files
committed
Reverts indentation to 2 spaces.
1 parent 6efb86f commit 28f1fc3

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

Stack/Stack.swift

+26-26
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
Push and pop are O(1) operations.
44
*/
55
public struct Stack<T> {
6-
fileprivate var array = [T]()
7-
8-
public var isEmpty: Bool {
9-
return array.isEmpty
10-
}
11-
12-
public var count: Int {
13-
return array.count
14-
}
15-
16-
public mutating func push(_ element: T) {
17-
array.append(element)
18-
}
19-
20-
public mutating func pop() -> T? {
21-
return array.popLast()
22-
}
23-
24-
public var top: T? {
25-
return array.last
26-
}
6+
fileprivate var array = [T]()
7+
8+
public var isEmpty: Bool {
9+
return array.isEmpty
10+
}
11+
12+
public var count: Int {
13+
return array.count
14+
}
15+
16+
public mutating func push(_ element: T) {
17+
array.append(element)
18+
}
19+
20+
public mutating func pop() -> T? {
21+
return array.popLast()
22+
}
23+
24+
public var top: T? {
25+
return array.last
26+
}
2727
}
2828

2929
extension Stack: Sequence {
30-
public func makeIterator() -> AnyIterator<T> {
31-
var curr = self
32-
return AnyIterator {
33-
return curr.pop()
34-
}
30+
public func makeIterator() -> AnyIterator<T> {
31+
var curr = self
32+
return AnyIterator {
33+
return curr.pop()
3534
}
35+
}
3636
}

0 commit comments

Comments
 (0)