File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
solution/0700-0799/0721.Accounts Merge Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,8 @@ class Solution {
179
179
Map<Integer , Set<String > > g = new HashMap<> ();
180
180
for (int i = 0 ; i < n; ++ i) {
181
181
int root = uf. find(i);
182
- g. computeIfAbsent(root, k - > new HashSet<> ()). addAll(accounts. get(i). subList(1 , accounts. get(i). size()));
182
+ g. computeIfAbsent(root, k - > new HashSet<> ())
183
+ .addAll(accounts. get(i). subList(1 , accounts. get(i). size()));
183
184
}
184
185
List<List<String > > ans = new ArrayList<> ();
185
186
for (var e : g. entrySet()) {
Original file line number Diff line number Diff line change @@ -177,7 +177,8 @@ class Solution {
177
177
Map<Integer , Set<String > > g = new HashMap<> ();
178
178
for (int i = 0 ; i < n; ++ i) {
179
179
int root = uf. find(i);
180
- g. computeIfAbsent(root, k - > new HashSet<> ()). addAll(accounts. get(i). subList(1 , accounts. get(i). size()));
180
+ g. computeIfAbsent(root, k - > new HashSet<> ())
181
+ .addAll(accounts. get(i). subList(1 , accounts. get(i). size()));
181
182
}
182
183
List<List<String > > ans = new ArrayList<> ();
183
184
for (var e : g. entrySet()) {
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ public List<List<String>> accountsMerge(List<List<String>> accounts) {
52
52
Map <Integer , Set <String >> g = new HashMap <>();
53
53
for (int i = 0 ; i < n ; ++i ) {
54
54
int root = uf .find (i );
55
- g .computeIfAbsent (root , k -> new HashSet <>()).addAll (accounts .get (i ).subList (1 , accounts .get (i ).size ()));
55
+ g .computeIfAbsent (root , k -> new HashSet <>())
56
+ .addAll (accounts .get (i ).subList (1 , accounts .get (i ).size ()));
56
57
}
57
58
List <List <String >> ans = new ArrayList <>();
58
59
for (var e : g .entrySet ()) {
You can’t perform that action at this time.
0 commit comments