Skip to content

Commit 035fc55

Browse files
authored
Update largest-number.cpp
1 parent a13a5c8 commit 035fc55

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

C++/largest-number.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class Solution {
1515

1616
// combine the numbers
1717
string max_num;
18-
for (auto& i : num) {
18+
for (const auto& i : num) {
1919
max_num.append(to_string(i));
2020
}
2121

2222
// special case: start with zero (e.g. [0, 0])
23-
if (max_num[0] == '0') {
23+
if (!max_num.empty() && max_num[0] == '0') {
2424
return "0";
2525
}
2626

0 commit comments

Comments
 (0)