-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
This bit is used in at least three problems. It's pretty useful and I don't think there's a name for it:
L[0] = 0;
for (int i = 1; i < N; i++) {
L[i] = i - 1;
while (heights[L[i]] <= heights[i] && L[i] > 0) L[i] = L[L[i]];
}
R[N - 1] = N - 1;
for (int i = N - 2; i >= 0; i--) {
R[i] = i + 1;
while (heights[R[i]] <= heights[i] && R[i] < N - 1) R[i] = R[R[i]];
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels