We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 61aa778 + 856fc3f commit 01c3d00Copy full SHA for 01c3d00
ksinji/202602/08 PGM 풍선 터트리기.md
@@ -0,0 +1,33 @@
1
+```java
2
+class Solution {
3
+ public int solution(int[] a) {
4
+ int answer = 0;
5
+
6
+ boolean[] survive = new boolean[a.length];
7
8
+ int left = Integer.MAX_VALUE;
9
10
+ for (int i=0; i<a.length; i++){
11
+ if (left > a[i]){
12
+ left = a[i];
13
+ survive[i] = true;
14
+ }
15
16
17
+ int right = Integer.MAX_VALUE;
18
19
+ for (int i=a.length-1; i>=0; i--){
20
+ if (right > a[i]){
21
+ right = a[i];
22
23
24
25
26
27
+ if (survive[i]) answer++;
28
29
30
+ return answer;
31
32
+}
33
+```
0 commit comments