We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Special String Again
- Discussions
Special String Again
Special String Again
Sort by
recency
|
786 Discussions
|
Please Login in order to post a comment
JS - fast
(hopefully) easy-to-read O(n) Python solution
I use a deque to keep track of previous counts to find the middle cases. I like this solution because there is a single loop while most other solutions have nested loops.
import { WriteStream, createWriteStream } from 'fs'; import { stdin, stdout } from 'process';
// Function to count special substrings function substrCount(n: number, s: string): number { let count = 0;
}
// Main function to handle input and output function main() { const inputLines: string[] = [];
}
main();
standard dynamic programming O(n) algo