title: Failing hidden tests in codesignal. What seems to be the problem in my code?
body: <p><a href="https://app.codesignal.com/arcade/intro/level-7/PTWhv2oWqd6p4AHB9" rel="nofollow noreferrer">https://app.codesignal.com/arcade/intro/level-7/PTWhv2oWqd6p4AHB9</a></p>
  
  <p>Here, the problem is that "Given an array of equal-length strings, you'd like to know if it's possible to rearrange the order of the elements in such a way that each consecutive pair of strings differ by exactly one character. Return true if it's possible, and false if not."</p>
  
  <p>and my code is</p>
  
  <pre><code>import itertools
  
  def only_one_element_different(x, y):
      list1 = []
      for i in x:
          list1.append(i)
      list2 = []
      for j in y:
          list2.append(j)
      list3 = []
      for k in range(0, len(list1)):
          if list1[k] == list2[k]:
              list3.append(True)
          else:
              list3.append(False)
      if list3.count(False) == 1:
          return True
      else:
          return False
  
  
  def if_list_is_linear(list):
      list4 = []
      for m in range(0, len(list)-1):
          if only_one_element_different(list[m], list[m+1]):
              list4.append(True)
          else:
              list4.append(False)
      if False in list4:
          return False
      else:
          return True
  
  list5 = ['aba', 'bbb','bab','bba']
  
  list6 = list(itertools.permutations(list5))
  
  list7 = []
  
  for n in list6:
      if if_list_is_linear(n) == True:
          list7.append(True)
      else:
          list7.append(False)
  
  if True in list7:
      print("Real True")
  else:
      print("False")
  ​
  </code></pre>
  
  <p>(In list5, The array is given)</p>
  
  <p>this passed all the tests but
  failed several hidden tests.</p>
  
  <p>I don't know if it is because of the timeout or flaws in my code.
  Please help</p>
  
  <p>(sorry for the bad english)</p>