Skip to content

Commit 7b76028

Browse files
authored
Update Solution.java
1 parent 1b0d46a commit 7b76028

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/main/java/g0701_0800/s0726_number_of_atoms/Solution.java

-6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ public String countOfAtoms(String formula) {
2424
Map<String, Integer> count = new HashMap<>();
2525
for (int i = formula.length() - 1; i >= 0; --i) {
2626
char c = formula.charAt(i);
27-
2827
if (c == '(') {
2928
product /= mlrStack.pop();
3029
continue;
3130
}
32-
3331
int rank = 1;
3432
int mlr = 0;
3533
while (isDigit(c)) {
@@ -42,21 +40,17 @@ public String countOfAtoms(String formula) {
4240
}
4341
mlrStack.push(mlr);
4442
product *= mlr;
45-
4643
if (c == ')') {
4744
continue;
4845
}
49-
5046
StringBuilder atom = new StringBuilder();
5147
while (isLower(c)) {
5248
atom.insert(0, c);
5349
c = formula.charAt(--i);
5450
}
5551
atom.insert(0, c);
5652
String name = atom.toString();
57-
5853
count.put(name, count.getOrDefault(name, 0) + product);
59-
6054
product /= mlrStack.pop();
6155
}
6256
List<String> atomList = new ArrayList<>(count.keySet());

0 commit comments

Comments
 (0)