We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 12cbf33 commit f937b5aCopy full SHA for f937b5a
Medium/Asteroid Collision.java
@@ -10,19 +10,17 @@ public int[] asteroidCollision(int[] asteroids) {
10
if (stack.peek() == Math.abs(asteroid)) {
11
stack.pop();
12
}
13
- }
14
- else {
+ } else {
15
stack.push(asteroid);
16
17
18
19
20
21
22
- int[] state = new int[stack.size()];
23
- for (int i = state.length - 1; i >= 0; i--) {
24
- state[i] = stack.pop();
+ int[] result = new int[stack.size()];
+ for (int i = result.length - 1; i >= 0; i--) {
+ result[i] = stack.pop();
25
26
- return state;
+ return result;
27
28
0 commit comments