can you check this code?
import java.util.Scanner;
import java.util.*;
class CQStack
{
public int maxSize;
public int[] stackArray;
public int top;
public CQStack(int s)
{
maxSize = s;
stackArray = new int[maxSize];
top = -1;
}
public boolean isEmpty()
{
return (top == -1);
}
public boolean isFull()
{
return (top == maxSize-1);
}
public void push(int j)
{
if(isFull())
{
return ;
}
else
{
stackArray[++top]=j;
}
}
public void pop()
{
int temp;
if(top==maxSize-1)
{
System.out.print("-1 β);
}
else
{
while(top>0)
{
topβ;
}
while(top<maxSize-2)
{
int c=stackArray[top];
int d=stackArray[top+1];
if(c<d)
{
System.out.print(d+β β);
}
if(c>d)
{
System.out.print(β-1"+" ");
}
top++;
}
}
}
}
class Main
{
public static void main(String[] args)
{
CQStack theStack = new CQStack(100);
Scanner s=new Scanner(System.in);
int t, n,q2;
n= s.nextInt();
while(n>0)
{
q2 = s.nextInt();
theStack.push(q2);
nβ;
}
theStack.pop();
}
}