• 个人简介

    def array_convert(link): # 数组转换法:将链表值复制到数组,然后用双指针判断回文 values = [] current = 0 # 当前节点索引,从链表头开始 while current != -1: # 遍历链表生成对应数组 values.append(link[current][0]) current = link[current][1] y=True left=0 right=len(values)-1 while y==True and left<=right: if values[left]==values[right]: continue else: not y if y: return True elif not y: return False

  • 最近活动

    This person is lazy and didn't join any contests or homework.