input: def sierpinski_triangle(n: int):
      """
      Generate the first n elements of the Sierpinski triangle.
      The Sierpinski triangle is a fractal and attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles.
      
      >>> sierpinski_triangle(1)
      '1'
      >>> sierpinski_triangle(2)
      '1\n0'
      >>> sierpinski_triangle(3)
      '1\n01\n101'
      >>> sierpinski_triangle(4)
      '1\n01\n101\n0101'
      """
output:     if n == 1:
          return '1'
      
      prev_row = '1'
      result = '1\n'
      
      for i in range(1, n):
          current_row = ''
          for j in range(len(prev_row) + 1):
              if j == 0 or j == len(prev_row):
                  current_row += '1'
              else:
                  current_row += '0' if prev_row[j-1] == prev_row[j] else '1'
          result += current_row + '\n'
          prev_row = current_row
      
      return result.strip()