Tweeted twitter.com/StackMma/status/850444296687935488
2 deleted 9 characters in body; edited title
source | link

How to Dublicateduplicate list elements

I have a list

S = {3, 4, 6, 1, 2, 5};

and I want every element to be dublicatedduplicated as many times as the value of the next element.

Note:The the last element should be dublicatedduplicated as many times as the value of the first element.

theThe result should look like this:

{{3, 3, 3, 3}, {4, 4, 4, 4, 4, 4}, {6}, {1, 1}, {2, 2, 2, 2, 2}, {5, 5, 5}}

{{3, 3, 3, 3}, {4, 4, 4, 4, 4, 4}, {6}, {1, 1}, {2, 2, 2, 2, 2}, {5, 5, 5}}

How to Dublicate list elements

I have a list

S = {3, 4, 6, 1, 2, 5};

and I want every element to be dublicated as many times as the value of the next element.

Note:The last element should be dublicated as many times as the value of the first element.

the result should look like this

{{3, 3, 3, 3}, {4, 4, 4, 4, 4, 4}, {6}, {1, 1}, {2, 2, 2, 2, 2}, {5, 5, 5}}

How to duplicate list elements

I have a list

S = {3, 4, 6, 1, 2, 5};

and I want every element to be duplicated as many times as the value of the next element.

Note: the last element should be duplicated as many times as the value of the first element.

The result should look like this:

{{3, 3, 3, 3}, {4, 4, 4, 4, 4, 4}, {6}, {1, 1}, {2, 2, 2, 2, 2}, {5, 5, 5}}

1
source | link

How to Dublicate list elements

I have a list

S = {3, 4, 6, 1, 2, 5};

and I want every element to be dublicated as many times as the value of the next element.

Note:The last element should be dublicated as many times as the value of the first element.

the result should look like this

{{3, 3, 3, 3}, {4, 4, 4, 4, 4, 4}, {6}, {1, 1}, {2, 2, 2, 2, 2}, {5, 5, 5}}