static bool TestDeque(IDeque <int> deque, int n) { if (deque.Size != 0) { return(false); } for (int i = 0; i < n; i++) { deque.Prepend(i); deque.Append(i); deque.RemoveFirst(); } if (deque.Size != n) { return(false); } if (n > 0 && (deque.First != 0 || deque.Last != n - 1)) { return(false); } int elem = -1; for (int i = 0; i < n; i++) { elem = deque.RemoveLast(); } if (deque.Size != 0 || elem != 0) { return(false); } return(true); }