add solution for single/double deque based.