



import doctest
from collections import deque

import numpy as np



class 		_lowercase		:

   def __init__(      self			:       Optional[Any]							)       ->				None:


    """simple docstring"""






    a						=		[2, 1, 2, -1]
    a						=		[1, 2, 3, 4]




   def 		A							(      self			:       Union[str, Any]							)       ->				list[float]:


    """simple docstring"""






    a						=		len(self.first_signal							)
    a						=		len(self.second_signal							)

    a						=		max(__lowerCAmelCase							,   __lowerCAmelCase							)

    # create a zero matrix of max_length x max_length
    a						=		[[0] * max_length for i in range(__lowerCAmelCase							)]

    # fills the smaller signal with zeros to make both signals of same length
    if length_first_signal < length_second_signal:
     self.first_signal += [0] * (max_length - length_first_signal)
    elif length_first_signal > length_second_signal:
     self.second_signal += [0] * (max_length - length_second_signal)
    for i in range(__lowerCAmelCase							):
     a						=		deque(self.second_signal							)
     rotated_signal.rotate(__lowerCAmelCase							)
     for j, item in enumerate(__lowerCAmelCase							):
      matrix[i][j] += item

        # multiply the matrix with the first signal
    a						=		np.matmul(np.transpose(__lowerCAmelCase							)							,   np.transpose(self.first_signal							)							)

    # rounding-off to two decimal places
    return [round(__lowerCAmelCase							,   2							) for i in final_signal]


if __name__ == "__main__":
     doctest.testmod()






def 	UpperCAmelCase__      (      UpperCAmelCase__ :Any					):






 '''simple docstring'''

 if not head:
  return True
 # split the list to two parts
 a		,  a						=		head.next, head
 while fast and fast.next:
  a						=		fast.next.next
  a						=		slow.next
 a						=		slow.next
 a						=		None  # Don't forget here! But forget still works!
 # reverse the second part
 a						=		None
 while second:
  a						=		second.next
  a						=		node
  a						=		second
  a						=		nxt
 # compare two parts
 # second part has the same or one less node
 while node:
  if node.val != head.val:
   return False
  a						=		node.next
  a						=		head.next
 return True


def 	UpperCAmelCase__      (      UpperCAmelCase__ :str					):






 '''simple docstring'''

 if not head or not head.next:
  return True

 # 1. Get the midpoint (slow)
 a						=		a						=		a						=		head
 while fast and fast.next:
  a		,  a						=		fast.next.next, slow.next

 # 2. Push the second half into the stack
 a						=		[slow.val]
 while slow.next:
  a						=		slow.next
  stack.append(slow.val					)

 # 3. Comparison
 while stack:
  if stack.pop() != cur.val:
   return False
  a						=		cur.next

 return True




def 	UpperCAmelCase__      (      UpperCAmelCase__ :Any					):






 '''simple docstring'''

 if not head or not head.next:
  return True
 a						=		{}
 a						=		0
 while head:
  if head.val in d:
   d[head.val].append(UpperCAmelCase__					)
  else:
   a						=		[pos]
  a						=		head.next
  pos += 1
 a						=		pos - 1
 a						=		0
 for v in d.values():
  if len(UpperCAmelCase__					) % 2 != 0:
   middle += 1
  else:
   a						=		0
   for i in range(0 ,					len(UpperCAmelCase__					)					):
    if v[i] + v[len(UpperCAmelCase__					) - 1 - step] != checksum:
     return False
    step += 1
  if middle > 1:
   return False
 return True

