collections deque () hackerrank solution python