We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34a18cd commit 5bd7b75Copy full SHA for 5bd7b75
palindromic-substrings/whewchews.ts
@@ -4,8 +4,8 @@ function countSubstrings(s: string): number {
4
const n = s.length;
5
6
// TC: O(N^2)
7
- for (let start = 0; start < n; start++) {
8
- for (let end = start; end >= 0; end--) {
+ for (let start = n; start >= 0; start--) {
+ for (let end = start; end < n; end++) {
9
if (start === end) {
10
dict.set(`${start}:${end}`, true);
11
} else if (start + 1 === end) {
0 commit comments