Time limit exceed solution
should move the visited node to the head of the memory in function 'int get(int key)'
ac