File tree 3 files changed +33
-2
lines changed
3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change
1
+ 1
2
+ 9
3
+ 34 8 10 3 2 80 30 33 1
Original file line number Diff line number Diff line change 1
1
1
2
- 7
3
- 6 2 5 4 5 1 6
2
+ 9
3
+ 34 8 10 3 2 80 30 33 1
Original file line number Diff line number Diff line change
1
+ #SHIV's code for maximum index
2
+
3
+ '''
4
+ 1
5
+ 9
6
+ 34 8 10 3 2 80 30 33 1
7
+ '''
8
+
9
+ tn = int (input ())
10
+
11
+ def process (arr ):
12
+ max_arr = []
13
+ for ind , i in enumerate (arr ):
14
+ interm = []
15
+ for ind2 , j in enumerate (arr ):
16
+ if ind2 < ind : continue
17
+ if i <= j :
18
+ interm .append (((ind , ind2 ),ind2 - ind ))
19
+ if interm :
20
+ max_dist = max (interm , key = lambda x : x [1 ])
21
+ max_arr .append (max_dist )
22
+ else : max_arr .append (((i , i ), 0 ))
23
+ print (max (max_arr , key = lambda x :x [1 ]))
24
+
25
+ for i in range (tn ):
26
+ ns = int (input ())
27
+ arr = list (map (int , input ().split ()))
28
+ process (arr )
You can’t perform that action at this time.
0 commit comments