質問編集履歴

4

2021/06/13 10:20

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -42,23 +42,25 @@
42
42
 
43
43
 
44
44
 
45
- for (int i = 0; i < unique.size(); i++) {
45
+ for (int i = 0; i < targetList.size(); i++) {
46
46
 
47
- for(int j = 0; j < unique.size(); j++) {
47
+ for(int j = 0; j < targetList.size(); j++) {
48
48
 
49
- if (unique.get(i) == unique.get(j)) {
49
+ if (targetList.get(i) == targetList.get(j)) {
50
50
 
51
51
  count++;
52
52
 
53
53
  }
54
54
 
55
- if(count<=2){
55
+ if(count>=2){
56
56
 
57
- unique.remove(i);
57
+ unique.add(targetList.get(i));
58
58
 
59
59
  }
60
60
 
61
61
  }
62
+
63
+ count = 0;
62
64
 
63
65
  }
64
66
 

3

2021/06/13 10:20

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -72,8 +72,6 @@
72
72
 
73
73
  UniqueString us = new UniqueString();
74
74
 
75
-                //この下の文字が表示されない
76
-
77
75
  List<String> unique = us.getUniqueList(Arrays.asList("a","b","c","b","c"));
78
76
 
79
77
 

2

2021/06/13 10:19

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -72,6 +72,8 @@
72
72
 
73
73
  UniqueString us = new UniqueString();
74
74
 
75
+                //この下の文字が表示されない
76
+
75
77
  List<String> unique = us.getUniqueList(Arrays.asList("a","b","c","b","c"));
76
78
 
77
79
 

1

2021/06/13 10:02

投稿

gknjnjtnj
gknjnjtnj

スコア7

test CHANGED
File without changes
test CHANGED
@@ -28,9 +28,9 @@
28
28
 
29
29
 
30
30
 
31
- public class UniqueString implements IKadai07_3 {
31
+ public class UniqueString {
32
32
 
33
- @Override
33
+
34
34
 
35
35
  public List<String> getUniqueList(List<String> targetList) {
36
36