Skip to main content
Commonmark migration
Source Link

#Python 3, 279 277 258 251 bytes

Python 3, 279 277 258 251 bytes

k=str.replace def f(x): z=len(x) y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): p=str(z+~i) if v in'-1'and~i+z:y+='+x^'+p elif'0'!=v:y+='+'+v+'x^'+p 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 and NK1406.

#Python 3, 279 277 258 251 bytes

k=str.replace def f(x): z=len(x) y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): p=str(z+~i) if v in'-1'and~i+z:y+='+x^'+p elif'0'!=v:y+='+'+v+'x^'+p 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 and NK1406.

Python 3, 279 277 258 251 bytes

k=str.replace def f(x): z=len(x) y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): p=str(z+~i) if v in'-1'and~i+z:y+='+x^'+p elif'0'!=v:y+='+'+v+'x^'+p 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 and NK1406.

added 42 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48

#Python 3, 279 277 258258 251 bytes

k=str.replace def f(x): z=len(x) y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): p=str(z+~i) if v in'-1'and~i+len(x)1'and~i+z:y+='+x^'+str(len(x)+~i)y+='+x^'+p elif'0'!=v:y+='+'+v+'x^'+str(len(x)+~i)y+='+'+v+'x^'+p 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!Try It Online!

Special thanks to ovs and NK1406.

#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.

#Python 3, 279 277 258 251 bytes

k=str.replace def f(x): z=len(x) y='--'*(['-1']==[c for c in x if'0'!=c][:1]) for i,v in enumerate(x): p=str(z+~i) if v in'-1'and~i+z:y+='+x^'+p elif'0'!=v:y+='+'+v+'x^'+p 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 and NK1406.

deleted 40 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48

#Python 3, 279 277277 258 bytes

k=str.replace def f(x): y='' y='--'*(['-1']==[c for ic in x:  if'0'!=i if'-1'==i=c][: y='--' break1]) 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!Try It Online!

Special thanks to ovs.

#Python 3, 279 277 bytes

k=str.replace def f(x): y=''  for i in x:  if'0'!=i if'-1'==i: y='--' break 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.

#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.

added 5 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
added 53 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
added 37 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
added 24 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
deleted 14 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
Post Undeleted by Manish Kundu
added 98 characters in body
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading
Post Deleted by Manish Kundu
Source Link
Manish Kundu
  • 5.4k
  • 2
  • 18
  • 48
Loading