Skip to content

Commit 788f2a4

Browse files
yanglbmeactions-user
authored andcommitted
style: prettify code
1 parent d2b1e2c commit 788f2a4

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

lcof/面试题30. 包含min函数的栈/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ class MinStack {
7272
s1 = new ArrayDeque<>();
7373
s2 = new ArrayDeque<>();
7474
}
75-
75+
7676
public void push(int x) {
7777
s1.push(x);
7878
s2.push(s2.isEmpty() || s2.peek() >= x ? x : s2.peek());
7979
}
80-
80+
8181
public void pop() {
8282
s1.pop();
8383
s2.pop();
8484
}
85-
85+
8686
public int top() {
8787
return s1.peek();
8888
}
89-
89+
9090
public int min() {
9191
return s2.peek();
9292
}

lcof/面试题31. 栈的压入、弹出序列/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ class Solution {
8484
* @param {number[]} popped
8585
* @return {boolean}
8686
*/
87-
var validateStackSequences = function(pushed, popped) {
88-
let s = [];
89-
let q = 0;
90-
for (let num of pushed) {
91-
s.push(num);
92-
while (s.length > 0 && s[s.length - 1] == popped[q]) {
93-
++q;
94-
s.pop();
95-
}
87+
var validateStackSequences = function (pushed, popped) {
88+
let s = [];
89+
let q = 0;
90+
for (let num of pushed) {
91+
s.push(num);
92+
while (s.length > 0 && s[s.length - 1] == popped[q]) {
93+
++q;
94+
s.pop();
9695
}
97-
return s.length == 0;
96+
}
97+
return s.length == 0;
9898
};
9999
```
100100

lcof/面试题31. 栈的压入、弹出序列/Solution.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* @param {number[]} popped
44
* @return {boolean}
55
*/
6-
var validateStackSequences = function(pushed, popped) {
6+
var validateStackSequences = function (pushed, popped) {
77
let s = [];
88
let q = 0;
99
for (let num of pushed) {
10-
s.push(num);
11-
while (s.length > 0 && s[s.length - 1] == popped[q]) {
12-
++q;
13-
s.pop();
14-
}
10+
s.push(num);
11+
while (s.length > 0 && s[s.length - 1] == popped[q]) {
12+
++q;
13+
s.pop();
14+
}
1515
}
1616
return s.length == 0;
17-
};
17+
};

0 commit comments

Comments
 (0)