Quantcast
Channel: Double-reduce a sequence of integers - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 6

Answer by Neil for Double-reduce a sequence of integers

$
0
0

Charcoal, 24 bytes

⊞υ⁰FEΦθκ⁻ι§θκ≔⁺υ⁻ιυυIΦυκ

Try it online! Link is to verbose version of code. Explanation: Adapted from both @Arnauld's and @loopywalt's answers.

⊞υ⁰

Start with a list of just 0.

FEΦθκ⁻ι§θκ

Loop over the list of differences of the input array.

≔⁺υ⁻ιυυ

Subtract all of the elements of the output array from the current difference and then concatenate the result onto the output array.

IΦυκ

Output all but the first element of the output array.


Viewing all articles
Browse latest Browse all 6

Trending Articles