File tree 1 file changed +24
-24
lines changed
1 file changed +24
-24
lines changed Original file line number Diff line number Diff line change @@ -17,33 +17,33 @@ public static void main(String[] args) {
17
17
}
18
18
19
19
public String [] largestItemAssociation (String [][] itemAssociation )
20
- { StringBuffer temp = new StringBuffer ();
21
- int n =Integer .MIN_VALUE ;
22
- Queue <String > q = new LinkedList <>();
23
- for (int i = 0 ; i < itemAssociation .length ; i ++){
24
- if (!q .isEmpty () && q .peek ()!=itemAssociation [i ][0 ]){
25
- if (n <q .size ()){
26
- n =q .size ();
27
- temp .setLength (0 );
28
- while (!q .isEmpty ()){
29
- temp .append (q .poll ()+"," );
20
+ { StringBuffer temp = new StringBuffer ();
21
+ int n =Integer .MIN_VALUE ;
22
+ Queue <String > q = new LinkedList <>();
23
+ for (int i = 0 ; i < itemAssociation .length ; i ++){
24
+ if (!q .isEmpty () && q .peek ()!=itemAssociation [i ][0 ]){
25
+ if (n <q .size ()){
26
+ n =q .size ();
27
+ temp .setLength (0 );
28
+ while (!q .isEmpty ()){
29
+ temp .append (q .poll ()+"," );
30
30
}
31
- }
32
- }
33
- for (int j =0 ;j < itemAssociation [0 ].length ;j ++){
31
+ }
32
+ }
33
+ for (int j =0 ;j < itemAssociation [0 ].length ;j ++){
34
34
if (!q .contains (itemAssociation [i ][j ]))
35
35
q .offer (itemAssociation [i ][j ]);
36
- }
37
- }
38
- if (n <q .size ()){
39
- n =q .size ();
40
- temp .setLength (0 );
41
- while (!q .isEmpty ()){
42
- temp .append (q .poll ()+"," );
43
- }
44
- }
45
- String [] re = temp .toString ().split ("," );
46
- return re ;
36
+ }
37
+ }
38
+ if (n <q .size ()){
39
+ n =q .size ();
40
+ temp .setLength (0 );
41
+ while (!q .isEmpty ()){
42
+ temp .append (q .poll ()+"," );
43
+ }
44
+ }
45
+ String [] re = temp .toString ().split ("," );
46
+ return re ;
47
47
}
48
48
49
49
}
You can’t perform that action at this time.
0 commit comments