Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit389c799

Browse files
committed
ItemAssociation
1 parent38c2b90 commit389c799

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

‎src/leetcode2018/ItemAssociation.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ public static void main(String[] args) {
1717
}
1818

1919
publicString[]largestItemAssociation(String[][]itemAssociation)
20-
{StringBuffertemp=newStringBuffer();
21-
intn=Integer.MIN_VALUE;
22-
Queue<String>q =newLinkedList<>();
23-
for(inti =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+
{StringBuffertemp=newStringBuffer();
21+
intn=Integer.MIN_VALUE;
22+
Queue<String>q =newLinkedList<>();
23+
for(inti =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()+",");
3030
}
31-
}
32-
}
33-
for(intj=0;j<itemAssociation[0].length;j++){
31+
}
32+
}
33+
for(intj=0;j<itemAssociation[0].length;j++){
3434
if(!q.contains(itemAssociation[i][j]))
3535
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-
returnre;
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+
returnre;
4747
}
4848

4949
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp