Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/careercup/ctci
/ previousElement
Method
previousElement
java/Chapter 3/Question3_1/QuestionB.java:55–61 ·
view source on GitHub ↗
(int index)
Source
from the content-addressed store, hash-verified
53
}
54
55
public
static
int
previousElement(
int
index) {
56
if
(index == 0) {
57
return
total_size - 1;
58
}
else
{
59
return
index - 1;
60
}
61
}
62
63
public
static
void
shift(
int
stackNum) {
64
StackData stack = stacks[stackNum];
Callers
2
shift
Method · 0.95
pop
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected