-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpra.java
More file actions
49 lines (45 loc) · 1 KB
/
pra.java
File metadata and controls
49 lines (45 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
class pra
{
public static void main(String[] args){
ArrayList<ArrayList<Integer>> map=new ArrayList<>();
ArrayList<Integer> inner=new ArrayList<>();
ArrayList<Integer> outer=new ArrayList<>();
inner.add(2);
inner.add(63);
map.add(inner);
outer.add(3426);
outer.add(353);
map.add(outer);
for(int i=0;i<map.size();i++){
for(int j=0;j<map.get(i).size();j++){
System.out.println(map.get(i).get(j));
}
}
}
}
class pra{
public static void main(String[] args){
}
public void balance(String st,int i,int j){
Stack<Character> sta=new Stack<>();
st.substring(i,j);
for(int i=0;i<s.length;i++){
char c=s.charAt(i);
if(c=='('||c=='{'||c=='['){
sta.push(c);
}
else if(c==']' && sta.peek()=='['){
sta.pop();
return true;
}
else if(c==')' && sta.peek()=='('){
sta.pop();
return true;
}
else if(c=='}' && sta.peek()=='{'){
sta.pop();
return true;
}
return false;
}