+ 3

what does this question mean?

I don't want solution of this question, i just want the explanation of the question. Write a program that reverses a 2D array of integers, implemented as nested list, in the order of 0th element of every inner list.

11th Feb 2021, 8:40 AM
Anshika
Anshika - avatar
1 Answer
+ 8
Not sure but I think it is to sort the list based on the first integer of each list inside the array. Example: array = [ [4, 2 ,3], [5, 6, 1], [1, 3, 4] ] # To improve readability and make it more look like a 2d array. array = [ [4, 2, 3], [5, 6, 1], [1, 3, 4] ] This is a 2d array, and I think you need to sort and reverse it based on the first integer of each list: In this example, we have 3 lists: ---> [4, 2, 3] ---> [5, 6, 1] ---> [1, 3, 4] And their first elements are 4, 5, and 1. INPUT: [ [4, 2 ,3], [5, 6, 1], [1, 5, 4] ] EXPECTED OUTPUT: [ [5, 6, 1], [4, 2 ,3], [1, 5, 4] ] - - - - - - - - - - - - - - - - - - - - - - - Again, this is not a sure answer. If this is wrong, please give us more details or the sample input and output. Thanks!
11th Feb 2021, 9:05 AM
noteve
noteve - avatar