Why I am getting an error?

below is my code -->

public static int ImpofTime(Queue q,int[] orig_order, int n) throws Exception{

// Write your Code here

int answer = 0;
for(int i = 0; i < n; i++) {
	if(q.getFront() == orig_order[i]) {
		answer++;
		q.dequeue();
	} else {
		while(q.getFront() != orig_order[i]) {
			int var = q.getFront();
			q.enqueue(var);
			q.dequeue();
			answer++;
		}
		answer++;
		q.dequeue();
	}
}


return answer;
} 


static Scanner scn = new Scanner(System.in);

public static void main(String[] args) throws Exception {

	Queue q = new Queue();

	int n = scn.nextInt();
	int[] process = new int[n];
	for (int i = 0; i < n; i++) {
		q.enqueue(scn.nextInt());
	}
	
	for(int i = 0;i < n;i++){
	
	    process[i] = scn.nextInt();
	}
	
	

	System.out.print(ImpofTime(q,process,n));

}

just change class name to Main
here is your corrected code:


if tis solves your doubt please mark it as resolved :slight_smile: