How can we slice an array into 4 equal parys | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can we slice an array into 4 equal parys

Pls how do u slice an array into 4 equal parts with any array of any length. I have created a little liner of code that gets any Integer and stores it in an array. Please help me https://code.sololearn.com/coPKQ4SvFp9K/?ref=app

14th Feb 2019, 6:18 AM
Sonicspeed^__^
Sonicspeed^__^ - avatar
1 Answer
+ 6
Sonicspeed^__^ A few doubts first, what if the number of elements isn't fully divisible by 4? one or more of the splits will have less elements than others. Second, what if the array has sub arrays in it?
14th Feb 2019, 7:21 AM
Ipang