title: How can I make rotate que by deque?
body: <p>My Code (by. List)</p>
  <pre><code>n, m = map(int, input().split())
  x = list(map(int,input().split()))
  
  a = [z for z in range(1, n+1)]
  print(a)
  # x = [d, e, f]
  
  f_idx = 0
  b_idx = 0
  
  for i in range(len(x)-1):
      if a.index(x[i]) == 0 :
              a.pop(0)
              print(a)
              
      
      elif a.index(x[i]) &lt;= a.index(x[i+1]) :
              while True:
                  a.append(a.pop(0))
                  f_idx += 1
                  if a.index(x[i]) == 0 :
                      a.pop(0)
                      print(a)
                      break    
                  
      elif a.index(x[i]) &gt; a.index(x[i+1]) :
             while True:
                 a.insert(0,a.pop(-1))
                 b_idx +=1
                 if a.index(x[i]) == 0 :
                     a.pop(0)
                     print(a)
                     break
                     print(a)
                     break
      
      if i == len(x)-2 :
          if a.index(x[i+1]) == 0 :
              a.pop(0)
  
          elif a.index(x[i+1]) &lt; len(a)/2:
              while True:
                  a.append(a.pop(0))
                  f_idx += 1
                  if a.index(x[i+1]) == 0 :
                      a.pop(0)
                      print(a)
                      break    
  
          else:
              while True:
                 a.insert(0,a.pop(-1))
                 b_idx +=1
                 if a.index(x[i+1]) == 0 :
                     a.pop(0)
                     print(a)
                     break
  
  print(&quot;f_idx :&quot;, f_idx)
  print(&quot;b_idx :&quot;, b_idx)
  print(a)
  </code></pre>
  <p>Practice(To make rotate Que)</p>
  <ul>
  <li>input1 :</li>
  </ul>
  <p>10, 3</p>
  <p>1, 2, 3</p>
  <ul>
  <li>output1 : (f.idx + b.idx)</li>
  </ul>
  <p>0</p>
  <ul>
  <li>input2 :</li>
  </ul>
  <p>10, 3</p>
  <p>2, 9, 5</p>
  <ul>
  <li>output2 : (f.idx + b.idx)</li>
  </ul>
  <p>8</p>
  <p>I already made rotate que by list.</p>
  <p>But I want to make rotate que by deque.</p>
  <p>So my question is 2.</p>
  <ol>
  <li><p>What is the time complexity of my code?</p>
  </li>
  <li><p>How can I make rotate que by deque?</p>
  </li>
  </ol>