import java.util.*;
class Solution {
boolean solution(String s) {
String[] input = s.split("");
Stack<Integer> stack = new Stack<Integer>();
for(int i=0; i<input.length; i++){
String now = input[i];
if(now.equals("(")){
stack.push(1);
}else if(now.equals(")")){
if(stack.isEmpty())
return false;
stack.pop();
}
}
if(stack.isEmpty())
return true;
else
return false;
}
}
이게 뭐지?import java.util.*;
class Solution {
boolean solution(String s) {
Stack<Integer> stack = new Stack<Integer>();
for(int i=0; i<s.length(); i++){
String brc = s.substring(i, i+1);
if(brc.equals("(")){
stack.push(1);
}else if(brc.equals(")")){
if(stack.isEmpty())
return false;
stack.pop();
}
}
if(stack.isEmpty())
return true;
else
return false;
}
}

쫌 되라
import java.util.*;
class Solution {
boolean solution(String s) {
Stack<Integer> stack = new Stack<Integer>();
for(int i=0; i<s.length(); i++){
char brc = s.charAt(i);
if(brc == '('){
stack.push(1);
}else if(brc == ')'){
if(stack.isEmpty())
return false;
stack.pop();
}
}
if(stack.isEmpty())
return true;
else
return false;
}
}