Skip to content

Commit 41cb2ac

Browse files
committed
fix: style
1 parent 2ca4e2c commit 41cb2ac

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lcci/03.01.Three in One/Solution.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ class TripleInOne {
44
cap = stackSize;
55
stk.resize(cap * 3 + 3);
66
}
7-
7+
88
void push(int stackNum, int value) {
99
if (stk[cap * 3 + stackNum] < cap) {
1010
stk[cap * stackNum + stk[cap * 3 + stackNum]] = value;
1111
++stk[cap * 3 + stackNum];
1212
}
1313
}
14-
14+
1515
int pop(int stackNum) {
1616
if (isEmpty(stackNum)) {
1717
return -1;
1818
}
1919
--stk[cap * 3 + stackNum];
2020
return stk[cap * stackNum + stk[cap * 3 + stackNum]];
2121
}
22-
22+
2323
int peek(int stackNum) {
2424
return isEmpty(stackNum) ? -1 : stk[cap * stackNum + stk[cap * 3 + stackNum] - 1];
2525
}
26-
26+
2727
bool isEmpty(int stackNum) {
2828
return stk[cap * 3 + stackNum] == 0;
2929
}

lcci/03.01.Three in One/Solution.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ public TripleInOne(int stackSize) {
66
cap = stackSize;
77
stk = new int[cap * 3 + 3];
88
}
9-
9+
1010
public void push(int stackNum, int value) {
1111
if (stk[cap * 3 + stackNum] < cap) {
1212
stk[cap * stackNum + stk[cap * 3 + stackNum]] = value;
1313
++stk[cap * 3 + stackNum];
1414
}
1515
}
16-
16+
1717
public int pop(int stackNum) {
1818
if (isEmpty(stackNum)) {
1919
return -1;
2020
}
2121
--stk[cap * 3 + stackNum];
2222
return stk[cap * stackNum + stk[cap * 3 + stackNum]];
2323
}
24-
24+
2525
public int peek(int stackNum) {
2626
return isEmpty(stackNum) ? -1 : stk[cap * stackNum + stk[cap * 3 + stackNum] - 1];
2727
}
28-
28+
2929
public boolean isEmpty(int stackNum) {
3030
return stk[cap * 3 + stackNum] == 0;
3131
}

0 commit comments

Comments
 (0)