title: Check if a list is a rotation of another list that works with duplicates
body: <p>I have this function for determining if a list is a rotation of another list:</p>
  
  <pre><code>def isRotation(a,b):
    if len(a) != len(b):
      return False
  
    c=b*2
    i=0
  
    while a[0] != c[i]:
      i+=1
  
    for x in a:
      if x!= c[i]:
        return False
      i+=1
  
    return True
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>&gt;&gt;&gt; a = [1,2,3]
  &gt;&gt;&gt; b = [2,3,1]
  &gt;&gt;&gt; isRotation(a, b)
  True
  </code></pre>
  
  <p>How do I make this work with duplicates? e.g. </p>
  
  <pre><code>a = [3,1,2,3,4]
  b = [3,4,3,1,2]
  </code></pre>
  
  <p>And can it be done in <code>O(n)</code>time?</p>