Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/neetcode-gh/leetcode
/ next
Method
next
java/0901-online-stock-span.java:8–14 ·
view source on GitHub ↗
(int price)
Source
from the content-addressed store, hash-verified
6
}
7
8
public
int
next(
int
price) {
9
int
span=1;
10
while
(!s.isEmpty() && s.peek()[0]<=price)
11
span+=s.pop()[1];
12
s.push(
new
int
[]{price,span});
13
return
span;
14
}
15
}
Callers
1
evictLeastFrequent
Method · 0.45
Calls
4
isEmpty
Method · 0.45
peek
Method · 0.45
pop
Method · 0.45
push
Method · 0.45
Tested by
no test coverage detected