flatten tag

3 questions


1 answers
427 views
0
Recursive function problems in javascript

function flatten(oldArr) { var newArr = [] for (var i = 0; i < oldArr.length; i++) { if (Array.isArray(oldArr[i])) { newArr = newArr.concat(flatten(oldArr[i])) } } else { newArr.push(oldArr[i]) } }...


1 answers
168 views
0
I'd like to share all the lists

L = [[[1, 2, 3], [4, 5]], 6]If the element in the list is a list like this [1, 2, 3, 4, 5, 6]I'm going to release all the elements of the list together.The way I know it, the list is[[1,2], [3,4], 5] ...


1 answers
141 views
0
How do I unfold python overlaid dict without a flatten external library?

nested = {'X': {'a': {'one': 10, 'two': 20}, 'b': {'one': 10, 'two': 20}, 'Y': {'a': {'one': 10, 'two': 20}, 'b': {'one': 10, 'two': 20}}}This dict value is nested = {'X_a_one':10, 'X_a_two':20...}I'...


© 2024 OneMinuteCode. All rights reserved.