Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/careercup/ctci
/ nextElement
Method
nextElement
java/Chapter 3/Question3_1/QuestionB.java:47–53 ·
view source on GitHub ↗
(int index)
Source
from the content-addressed store, hash-verified
45
}
46
47
public
static
int
nextElement(
int
index) {
48
if
(index + 1 == total_size) {
49
return
0;
50
}
else
{
51
return
index + 1;
52
}
53
}
54
55
public
static
int
previousElement(
int
index) {
56
if
(index == 0) {
Callers
2
shift
Method · 0.95
push
Method · 0.95
Calls
no outgoing calls
Tested by
no test coverage detected