Skip to main content
8 of 10
deleted 40 characters in body
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48

#Python 3, 279 277 258 bytes

k=str.replace def f(x): y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): if v in'-1'and~i+len(x):y+='+x^'+str(len(x)+~i) elif'0'!=v:y+='+'+v+'x^'+str(len(x)+~i) return y and k(k(k(k(y[1:],'+-','-'),'^1',''),'x^0',''),'-+','-')or 0 

Takes input as a list of strings. This solution is not highly golfed yet. This basically works by replacing things to suit the output format, which highly increases the byte count.

Try It Online!

Special thanks to ovs.

Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48