Skip to content

Conversation

sp995
Copy link

@sp995 sp995 commented Jan 10, 2025

No description provided.

sp995 added 4 commits January 10, 2025 12:15
…] cars) { int length = cars.length; double[] times = new double[length]; Deque<Integer> stack = new LinkedList<Integer>(); for (int i = length - 1; i >= 0; i--) { while (!stack.isEmpty()) { if (cars[stack.peek()][1] >= cars[i][1]) stack.pop(); else { if (times[stack.peek()] < 0) break; double time = times[stack.peek()] * (cars[i][1] - cars[stack.peek()][1]); if (time > cars[stack.peek()][0] - cars[i][0]) break; else stack.pop(); } } if (stack.isEmpty()) times[i] = -1; else times[i] = (double) (cars[stack.peek()][0] - cars[i][0]) directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant