Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 201 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, (削除) 22 17 (削除ここまで) 177 bytes

-10 bytes by realising I'd implemented convolution - go upvote Luis Mendo's MATL answer too, as that was what made me realise this.

×ばつ€Œd§ṙLC${Ṛðæc/ṫ‘}Ḣ

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Try it online! Or see the test suite test suite.

How?

æc/ṫ‘}Ḣ - Link: list of lists, Ps; integer, E
 / - reduce (Ps) by:
æc - convolution
 } - use right argument (E) for:
 ‘ - increment -> E+1
 ṫ - tail from (1-indexed) index (E+1)
 Ḣ - head (if given an empty list yields 0)

The 17 (without the convolution atom) was:

×ばつ€Œd§ṙLC${Ṛð/ṫ‘}Ḣ

Jelly, (削除) 22 (削除ここまで) 17 bytes

×ばつ€Œd§ṙLC${Ṛð/ṫ‘}Ḣ

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite.

Jelly, (削除) 22 17 (削除ここまで) 7 bytes

-10 bytes by realising I'd implemented convolution - go upvote Luis Mendo's MATL answer too, as that was what made me realise this.

æc/ṫ‘}Ḣ

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite.

How?

æc/ṫ‘}Ḣ - Link: list of lists, Ps; integer, E
 / - reduce (Ps) by:
æc - convolution
 } - use right argument (E) for:
 ‘ - increment -> E+1
 ṫ - tail from (1-indexed) index (E+1)
 Ḣ - head (if given an empty list yields 0)

The 17 (without the convolution atom) was:

×ばつ€Œd§ṙLC${Ṛð/ṫ‘}Ḣ
deleted 106 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 22 (削除) 22 (削除ここまで) 17 bytes

×ばつ€Œd§ṙLC${Ṛð/;0ẋ$}ị@‘ṫ‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Try it online! Or see the test suite .

Feels too long; 5 bytes used just to handle the higher than maximal coefficient casestest suite.

Jelly, 22 bytes

×ばつ€Œd§ṙLC${Ṛð/;0ẋ$}ị@‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite .

Feels too long; 5 bytes used just to handle the higher than maximal coefficient cases.

Jelly, (削除) 22 (削除ここまで) 17 bytes

×ばつ€Œd§ṙLC${Ṛð/ṫ‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite.

added 295 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 22 bytes

×ばつ€Œd§ṙLC${Ṛð/;0ẋ$}ị@‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite .

Feels too long; 5 bytes used just to handle the higher than maximal coefficient cases.

Jelly, 22 bytes

×ばつ€Œd§ṙLC${Ṛð/;0ẋ$}ị@‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online!

Feels too long; 5 bytes used just to handle the higher than maximal coefficient cases.

Jelly, 22 bytes

×ばつ€Œd§ṙLC${Ṛð/;0ẋ$}ị@‘}

A dyadic link accepting a list of coefficient lists on the left and the exponent on the right.

Try it online! Or see the test suite .

Feels too long; 5 bytes used just to handle the higher than maximal coefficient cases.

Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading

AltStyle によって変換されたページ (->オリジナル) /