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 Revisions

2 of 2
deleted 36 characters in body
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

CJam, (削除) 22 (削除ここまで) 21 bytes

Saved 1 byte thanks to Martin Ender

{_,({0\f+}*ee::m<:.+}

Anonymous block expecting the argument on the stack and leaves the result on the stack.

Try it online!

How it works

_ e# Duplicate the matrix
 ,( e# Get its length (# of rows) minus 1
 {0\f+}* e# Prepend that many 0s to each row
 ee e# Enumerate; map each row to [index, row]
 ::m< e# Rotate each row left a number of spaces equal to its index
 :.+ e# Sum each column
Business Cat
  • 9.2k
  • 1
  • 18
  • 37

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