Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Brackets balancing
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { String input = "a(((b+c)+d)"; char[] c = input.toCharArray(); char[] x = new char[c.length]; int top=-1; for(int i=0;i<c.length;i++){ if(c[i] == '('){ top=top+1; x[top]=c[i]; } else if(c[i] == ')'){ top=top-1; } } if(top==-1){ System.out.println("Brackets are balanced"); } else System.out.println("Brackets are not balanced"); } }
run
|
edit
|
history
|
help
0
Decode byte array
nth fibonacci ( memoization )
Assignment for Web Software Developer position
evenloop
Sample for https://stackoverflow.com/a/49984959/4216641
Bbs
Vikas
// Java Coding Challenge - 09: Find out duplicate numbers using Array
Piramid
Java tester