We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9b7f897 commit 4df50d8Copy full SHA for 4df50d8
C++/additive-number.cpp
@@ -4,7 +4,7 @@
4
class Solution {
5
public:
6
bool isAdditiveNumber(string num) {
7
- for (int i = 1; i < num.length() - 1; ++i) {
+ for (int i = 1; i < num.length(); ++i) {
8
for (int j = i + 1; j < num.length(); ++j) {
9
string s1 = num.substr(0, i), s2 = num.substr(i, j - i);
10
if ((s1.length() > 1 && s1[0] == '0') ||
0 commit comments