自己设计一个就是了,不见的有多难

解决方案 »

  1.   

    队列是先进先出的,
    public class MyArray{
       int[] a;
       int head,tail;
       public MyArray(){
         a=new int[100];
         head=-1;
         tail=0;
       }
       public void add(int value){
         if(tail<100)
         a[tail++]=value;
         else if(tail-head<=100)
         //...move
         
       }
       public int remove(){
         if(head<0||tail-head<=1)return -1;//empty
         return a[head++];
       }
    }