vault backup: 2022-07-14 10:09:31
This commit is contained in:
parent
ae73cbe6b8
commit
bbcd5e02d5
|
@ -69,6 +69,8 @@ similar to this one.
|
|||
|
||||
The goal is making cur as small as possible, without duplicating
|
||||
|
||||
And the localMax is max(localMax, i - cur)
|
||||
|
||||
### Solution
|
||||
|
||||
Kadane's algorithm
|
||||
|
@ -90,6 +92,7 @@ public:
|
|||
}
|
||||
|
||||
hMap[s[i]] = i;
|
||||
// The char at cur is ignored
|
||||
localMax = max(localMax, i - cur);
|
||||
}
|
||||
return localMax;
|
||||
|
|
Loading…
Reference in a new issue