# Why Wrong Anwsers about my solution?

• When I use IDE check my solution, it can show the right answers. But when I submit my answers on the leetcode, it always shows wrong answers like:
Input: [1,1,1,2]
Output: [1,1,1]
Expected: [1,1,2]

``````public int removeDuplicates(int[] A) {
Stack<Integer> stack1 = new Stack<Integer>();
Stack<Integer> stack2 = new Stack<Integer>();
List<Integer> list = new ArrayList<Integer>();
if(A.length == 0){
return 0;
}
for(int i = 0; i < A.length; i++){
stack1.push(A[i]);
}
int temp = stack1.pop();
while(!stack1.isEmpty()){
int temp1 = stack1.pop();
if(temp != temp1){
temp = temp1;
}else{
stack2.push(temp1);
}
}
if(!stack2.isEmpty()){
int temp2 = stack2.pop();
while(!stack2.isEmpty()){
int temp3 = stack2.pop();
if(temp2 != temp3){
temp2 = temp3;
}else{
continue;
}
}
}
int[] B = new int[list.size()];
for(int i = 0; i < list.size(); i++){
B[i] = list.get(i);
}
A = B;
Arrays.sort(A);
return A.length;
}``````

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.