Skip to content
Advertisement

Use global positions to mutate list, in list of lists

I need to keep my data in a list of lists, but want to edit elements in the lists based on their overall position.

For instance:

JavaScript

I want to change position 5 as if it was all one list resulting in:

JavaScript

This is for very large lists and lots of mutations so speed is essential!

Advertisement

Answer

Here is the solution of your’s question

JavaScript

Output:

JavaScript
Advertisement